General discussion

Locked

Passing function names from forms into J

By eightypoundpack ·
I'm trying to call on a function, the name of which is being passed into the JavaScript as a variable from a form. Unfortunately, JavaScript isn't recognizing the passed variable as a method.

I've presented the problem on two Web pages, a form page and a personalized message page. Only the age range radio buttons present this problem. Here's the URL for the first of the two pages: httpwww.geocities.com/eightypoundpack/submit-congrat2.html

Thanks in advance for any help you can give me.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

exec function

by Jay Eckles In reply to Passing function names fr ...

Have you tried
exec( age ) ;

If not, why not do something like change the values of the age radio buttons on the form page to "child", "young adult", etc., then do something like

if( age == "child" ){
congratChild() ;
}

Just a thought.

Jay

Collapse -

Easy stuff

by phil_perkins_1 In reply to Passing function names fr ...

Instead of doing document.write(age), all you need is eval(age). The function will take care of writing out the information. Your code looks like this:

// HERE'S WHERE I'm running into trouble. Can you spot the problem?

document.write(age);
+ age +

document.write("<P>");

document.write("<P><B>As you can see below, if the function names are entered directly into the code, they work without a hitch.<\/B><\/P>");


It should look like this:

// HERE'S WHERE I'm running into trouble. Can you spot the problem?

eval(age);

document.write("<P>");

document.write("<P><B>As you can see below, if the function names are entered directly into the code, they work without a hitch.<\/B><\/P>");

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums