SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Oct 15, 2006, 21:19 #1
- Join Date
- May 2004
- Location
- USA
- Posts
- 0
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Choosing submit button with javascript
I have a form with the following drop down
Code:<select name="option" onChange="nav(this);"> <option value="">----------------</option> <option value="copyfile">Copy</option> <option value="renamefile">Rename</option> ......yadda yadda..... </select>
Im wanting a certain submit a certain input button (I have several different ones in one form) depending on which drop down item they select.
So if they select Copy. I would want the javascript function to basically act like <input type="submit" name="copyfile" /> was clicked, and similarly if Rename was clicked, I would like it to act as if <input type="submit" name="rename" /> was submitted.
Thanks,
gex6
-
Oct 16, 2006, 00:06 #2
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:function nav(obj) { switch(obj.options[obj.selectedIndex].value == "bla") { case "bla": alert("bla"); break; case "blabla": alert("blabla"); break, } }
Bookmarks