Jump to content

Noob Javascript Question


Guest Spalton

Recommended Posts

Hi guys, first time poster here, spent the morning scratching my head and hoping you can help!

 

 

I've got a number of forms (form1, form2, form3....) all of which have a checkbox in them (script1CheckBox, script2CheckBox, script3CheckBox...etc etc).

 

When a checkbox is clicked it calls the following procedure, basically I need to know WHICH checkbox was clicked. I am a totla newbie when it comes to this but came up with the below:

 

function assignVar()

{

 

for (var arrNum = 0; arrNum <= 30; arrNum++)

{

 

formNum = "form"+arrNum;

scriptCheckNum = "scriptCheckBox"+arrNum;

if (document.(formNum).(scriptCheckNum).checked)

{

questionNumber = arrNum;

return questionNumber;

console.log(questionNumber);

}

 

}

}

 

yet am getting no output from it. Can anyone point out where I'm going wrong?

 

Thankyou in advance!

 

Chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...