4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Javascript and Netscape 7.xx
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
littlebrat
Junior WebHelper
Junior WebHelper


Joined: 26 Oct 2004
Posts: 1

PostPosted: Tue Oct 26, 2004 3:07 pm (12 years, 12 months ago) Reply with QuoteBack to Top

Hi all,

I have this prolem with my js where the onchange in the html didn't work in NS7.xx but worked in IE 6. I was wondering what is the most common discrepancy in using js in both IE and NS? I couldn't find a complete guide on how to tackle this problem, while most of the website or forums says that js shld have no problem in IE and NS. Anyway, i enclose the skeleton of my code, so it would be better for you guys to figure out what might be wrong. Assume and logic and the naming of var are correct, i am just wondering whether the syntax for JS is different for both browsers? Here goes;

here's the skeleton of my html: As i was saying, 2 drop down boxes are involved where using onChange, whenever the option for the 1st drop down is changed, then the content of the 2nd drop down box will be changed/reloaded because of the change in the 1st drop down selection. So here goes:


<!-- START -->

....

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">

....

function B(aVal){

var len = document.formName.B.options.length;
var i = len - 1;

while(document.formName.B.options.length > 0){
document.formName.B.options.remove(i);
i--;
}

if(aVal == "A1"){

var newElem1 = document.createElement("OPTION");
var newElem2 = document.createElement("OPTION");

newElem1.text = "C1";
newElem1.value = "C1";
newElem2.text = "C2";
newElem2.value = "C2";

document.login.B.options.add(newElem1);
document.login.B.options.add(newElem2);
}

else{

var newElem1 = document.createElement("OPTION");
var newElem2 = document.createElement("OPTION");

newElem1.text = "D1";
newElem1.value = "D1";
newElem2.text = "D2";
newElem2.value = "D2";

document.login.B.options.add(newElem1);
document.login.B.options.add(newElem2);
}
}

........

<form name="formName" method="post" action="">

.......


<div align="right">
<select name="A" onChange="B(A.value);">
<option value="A1">A1</option>
<option value="A2">A2</option>
</select>
</div>

<div align="right">
<select name="B">
<option value="B1">B1</option>
<option value="B2">B2</option>
</select>
</div>

......

<!-- END -->


Thanks a lot guys!! anxiously awaitinf your answers!! =)
OfflineView User's ProfileFind all posts by littlebratSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.056139 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme