Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 05-13-2009, 11:02 PM javascript firefox
Jaye's Avatar
Novice Talker

Posts: 9
Trades: 0
I have a page with one form and 39 drop down select lists.
each Select list has 4 options, like a quiz, where there's a question a user will reply by selecting one of the answers in drop down list. Now first option is always skip this question with value=0 i want to collect everything above "0" into a div called selTop, get value from that list and update selTop innerhtml.
i have this code that works fine with Internet Explorer but it does not work with Firefox, can someone find and alternative for this.

Code:
<div id="selTop"></div><input type="button" value="Update" onclick="update()">

<script language="javascript">
    function update(){
    document.getElementById("selTop").innerHTML="";
    var i=1;
    for (i=1;i<=35;i++)
    {
    n=document.myform.elements(i).value
    if (n >= "1"){
    var d= (document.myform.elements(i).name);
    document.getElementById("selTop").innerHTML = document.getElementById("selTop").innerHTML + "<br>" + (d);
    }}}
</script>

Last edited by Jaye; 05-13-2009 at 11:03 PM..
Jaye is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-14-2009, 08:30 AM Re: javascript firefox
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
elements(i) ???
should be:
elements[i]

I guess () works in IE, but it's totally wrong. Arrays are always supposed to be in []



__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-14-2009, 08:42 AM Re: javascript firefox
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
I guess () works in IE, but it's totally wrong. Arrays are always supposed to be in []
Welcome in the ms world...
IE, in fact, has no support for javascript, but for vbscript.
Vbscript implements a lot of what javascript does, and is somewhat compatible.

And, in vb, you define an array with (), not with [].
Thus why it works in ie, and only in ie.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-14-2009, 10:35 AM Re: javascript firefox
Jaye's Avatar
Novice Talker

Posts: 9
Trades: 0
Thanks a lot guys that was the error now it works in IE and Firefox both.
Jaye is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to javascript firefox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting 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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13750 seconds with 12 queries