General discussion

  • Creator
    Topic
  • #2335874

    Passing function names from forms into J

    Locked

    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: http:/www.geocities.com/eightypoundpack/submit-congrat2.html

    Thanks in advance for any help you can give me.

All Comments

  • Author
    Replies
    • #3584029

      exec function

      by jay eckles ·

      In reply to Passing function names from forms into J

      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

    • #3582349

      Easy stuff

      by phil_perkins_1 ·

      In reply to Passing function names from forms into J

      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(“

      “);

      document.write(“

      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(“

      “);

      document.write(“

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

Viewing 1 reply thread