Sending multiple variables at once to a .js page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bugboy
    New Member
    • Sep 2007
    • 160

    #1

    Sending multiple variables at once to a .js page

    Hi I'm using an <input type="submit"> to send variables to a js page when clicked.
    The code bellow allows me to send 3 variables to the js page.. is there a way to add more variables the the tag that will be passed along?

    Or can i have it send along a <input type="hidden" value="var4"> tag like a normal form?

    Thanks

    Bug Boy

    [HTML] <input type="submit" title="A" name="B" value="C" onclick="edit(t his.value,this. name,this.title )/>[/html]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    edit() would be a JavaScript function. Can you post the code for that function?

    Comment

    • bugboy
      New Member
      • Sep 2007
      • 160

      #3
      I've got it figured.. I didn't understand how functions worked. i just added another variable then caught it on the js page by adding it there as well and modifying the header creator to pass it with the URL. it took some time to figure out the escaping forward slashes on the single quotes around the new variable because the "this.title " didn't use quotes but direct variable values need them. like this:

      (ps a bug is preventing me from putting the closing tag on the below code and is also chopping off any text i put after it..)

      Code:
      edit_refine_menu(this.value,this.name,this.title,\'var4\')

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by bugboy
        I've got it figured.. I didn't understand how functions worked. i just added another variable then caught it on the js page by adding it there as well and modifying the header creator to pass it with the URL. it took some time to figure out the escaping forward slashes on the single quotes around the new variable because the "this.title " didn't use quotes but direct variable values need them.
        You wouldn't need them if you use single quotes within double quotes.
        Originally posted by bugboy
        (ps a bug is preventing me from putting the closing tag on the below code and is also chopping off any text i put after it..)
        Yes, I noticed your post in the feedback forum.

        Anyway, glad you've got it sorted.

        Comment

        Working...