Andrei Freeman (lordandrei) wrote,
Andrei Freeman
lordandrei

  • Mood:

Calling JavaScripters, take my LJ Challenge

So, many say that LJ is just a repository of fluff. That it holds no real innate value.

So, I now put it out there. This is my test and situation.

I am trying to teach myself JavaScript. I think I've written my code correctly. Only problem is.. it doesn't work. Actually it doesn't do anything at all

So, below the cut I will explain the problem, code, and issue. I will leave myself logged on via AIM and Yahoo. I am curious to see how long it takes for someone to find read my issue and get in contact with me to aid the solution :)

Theoretically this is a very simple problem. :)

This is my current JavaScript quandry it is actually in two parts.

I have created a table that has 3 radio buttons, 3 simple text labels, and 3 text fields and 1 submit button. These all sit in a form:

label 1
label 2
label 3

The form:
   Has a name and id of "NewData"

The radio buttons
   Are all named "ModChoice"
   Have values of 1, 2, and 3 respectively.
   onClick="radioClick(this.value)"

Up in the <head> section of the html I have written the following:
<script language="JavaScript" type="text/javascript">
<!--

function radioClick(radioChoice)
{
	alert("Click in button [" . radioChoice . "]")
	switch (radioChoice) {
		{{Other stuff removed}}
	}
}
//-->
</script>


So, question 1. When someone clicks a radio button, why doesn't RadioClick get called?. When I hit one of the radio buttons, nothing happens.

Advanced question 2. I'd like to use the switch statement to change the css "on the fly" so that selecting a button causes the text in the unselected choices to change to a dimmer colour and the associated text fields 'disable'.

From my reading, issue 1 should just work. Granted, I've yet to comprehend how JavaScript feels about semi-colon usage. I've seen examples that do and don't use it.

So... comments? Thanks!
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 10 comments