Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > javascript won't work in firefox

javascript won't work in firefox
Thread Tools
Junior Member
Join Date: Nov 2004
Location: Michigan
Status: Offline
Reply With Quote
Mar 6, 2005, 04:35 PM
 
I've got this javascript that works in Safari and Camino but not Firefox, please someone help! Its supposed to auto generate another input box. It doesn't give any errors and the new inputs show up in the DOM Inspector.
Code:
<html> <script> function ga() { var inp = document.createElement("input"); var add = document.createElement("input"); add.setAttribute("type", "submit"); add.setAttribute("value", "Add Another"); inp.setAttribute("type", "text"); inp.setAttribute("name", "stupid"); var br = document.createElement("br"); document.getElementsByTagName("table")[0].appendChild(br); document.getElementsByTagName("table")[0].appendChild(inp); document.getElementsByTagName("table")[0].appendChild(add); } </script> <body> <form action="" method="get" onSubmit='ga();return false;'> <table name='append'> <input type="text" name="field1" value=""/> <input name="Submit" type="submit" value="Add Another"/> </table> </form> </body> </html>
     
ctlq  (op)
Junior Member
Join Date: Nov 2004
Location: Michigan
Status: Offline
Reply With Quote
Mar 6, 2005, 04:51 PM
 
nevermind, like always, this was one of those things that as soon as I posted I found the answer even though I spent well over an hour trying stuff before posting. For anyone that'd like to know, put the code inside a try {}.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:14 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2