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 Problem with FireFox

Javascript Problem with FireFox
Thread Tools
Junior Member
Join Date: May 2003
Status: Offline
Reply With Quote
Jan 6, 2005, 06:43 PM
 
Hello folks,

I've written what I thought was a very simple javascript function, but it doesn't seem to work with Firefox. Works great with Safari though. Can someone take a look and tell me if they see the problem?

<SCRIPT type="text/javascript">

function insertPhoto() {
var imgKEY = entry.u_photo_list.options[entry.u_photo_list.selectedIndex].value;
entry.u_content.value = entry.u_content.value + " [photo:" + imgKEY + "]";
}

</SCRIPT>

Anyone see the problem? It just doesn't seem to execute in Firefox.

Thanks!
Jon Marus
www.jmarus.com - kicks by JM
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jan 6, 2005, 06:52 PM
 
Have you tried looking in Firefox's JavaScript Console? It's under the Tools menu, and it can provide useful information. Use the Clear button to empty out its messages first, and then try to load the page. Tell us what it has to say; it might help.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
jon31  (op)
Junior Member
Join Date: May 2003
Status: Offline
Reply With Quote
Jan 6, 2005, 06:59 PM
 
Oh, i was not aware of the javascript console, how handy. It's getting me the error:

Entry is not defined.

Does that help?
www.jmarus.com - kicks by JM
     
jon31  (op)
Junior Member
Join Date: May 2003
Status: Offline
Reply With Quote
Jan 6, 2005, 07:02 PM
 
Wait, entry is the name of the form. Hmm..

Maybe I'm linking to it improperly with my Javascript.
www.jmarus.com - kicks by JM
     
jon31  (op)
Junior Member
Join Date: May 2003
Status: Offline
Reply With Quote
Jan 6, 2005, 07:07 PM
 
Ok, looks like all I was missing was "document.". Silly me. Thanks for your help! The javascript console really sped things up.
www.jmarus.com - kicks by JM
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jan 7, 2005, 11:12 AM
 
Firefox's JavaScript tools are great for this sort of thing. It's why I tend to do JavaScript stuff in Firefox/Mozilla first; I use it to weed out basic errors in my code, and then once that's done I test it in other browsers and tweak it if I have to. It makes things go a lot faster..

Mozilla has the console too, if you prefer to use that. Safari has something similar, but it's pretty well-hidden. You have to enable the Debug menu, then tell it to log JavaScript errors, then open Console.app (not to be confused with Terminal.app) and look for the errors there.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
   
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:04 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