Click to See Complete Forum and Search --> : Conflicting scripts?
ben456
02-04-2003, 08:02 PM
I have two scripts on a page which appear to be conflicting, (in NS only, not in IE). Both open pop-up windows and make use of "form" and "this.form" statements. Tried changing the object names n one of the scripts but it stopped working. Are form and this.form protected names that cannot be changed?
Thanks in anticipation,
Ben
khalidali63
02-04-2003, 08:04 PM
The first thing I'd suggest is go throgh both .js files and see if there are any matching global variables or function names.if there are any make the unique.
cheers
Khalid
ben456
02-04-2003, 08:24 PM
Thanks for the prompt response. There are no .js files. Snip of code is as follows -
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
site = "http://www.yoursite.com"; // Do not include the final "/"
function combineMenus(frm, menu1, menu2) {
with (frm) {
str = menu1.options[menu1.selectedIndex].value;
str += menu2.options[menu2.selectedIndex].value;
url = site + "/" + str + ".html";
window.location.href = url;
}
}
// End -->
<!-- Begin
function formHandler(form) {
var windowprops = "height=470,width=780,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable=yes";
var URL = form.site.options[form.site.selectedIndex].value;
popup = window.open(URL,"MenuPopup",windowprops);
}
// End -->
</script>
</HEAD>
<BODY>
<form name=menufrm>
<select name=menu1>
<option value="">Make</option>
<option value="Ford">Ford</option>
<option value="Chevy">Chevy</option>
<option value="Toyota">Toyota</option>
</select>
<select name=menu2>
<option value="">Year</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
</select>
<input type=button value="Select" onClick="combineMenus(this.form, this.form.menu1, this.form.menu2)">
</form>
<form name=form>
<select name=site onChange="formHandler(this.form)">
<option selected>Select</option>
<option value="http://www.yoursite.com/red.htm">Red</option>
<option value="http://www.yoursite.com/blue.htm">Blue</option>
<option <option value="http://www.yoursite.com/green.htm">Green</option>
</select>
</form>
</BODY>
khalidali63
02-04-2003, 08:33 PM
The pice of code you posted does work in NS6+ and IE
There was tiny mistake which could be the editor related. anyways try this method
again
<!-- Begin
function formHandler(form) {
var windowprops = "height=470,width=780,location=no,"
+ " scrollbars=yes,menubars=no,toolbars=no,resizable=yes";
var URL = form.site.options[form.site.selectedIndex].value;
popup = window.open(URL,"MenuPopup",windowprops);
}
// End -->
if u think problem is still there then refere to exact browser version
cheers
Khalid
Sergey Smirnov
02-04-2003, 08:36 PM
I kept the handler as was, but changed the caller like:
onClick="frm=document.forms.menufrm; combineMenus(frm, frm.menu1, frm.menu2)"
Works everywhere.
ben456
02-05-2003, 04:57 AM
Thanks guys. Can't see the difference with the code but changed it anyway and changed the caller but still having the same problem.
Am using Netscape 6 - Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; m18) Gecko/20010131 Netscape6/6.01.
Thanks,
Ben
khalidali63
02-05-2003, 05:12 AM
Is there something you missed to post ?
Because I did run your code last night and it did work without me doing anything...or may be explain the event that triggers the error u are referring to..
cheers
Khalid
ben456
02-05-2003, 05:18 AM
Khalid, can you try www.justhoroscopes.com/test.htm (http://www.justhoroscopes.com/test.htm) and see if the "Love Match" works in Netscape? (The page is a work in progress by the way.)
Thanks,
Ben
khalidali63
02-05-2003, 05:20 AM
yes it does,it actually opened up a window with my "love match" (whispering thank god my wife is asleep,otherwise she would love to call me a perv)
lol.
Yes it brings up the window.unless ofcourse it was suppose to do something dif that I missed
ben456
02-05-2003, 05:31 AM
Hmmm, that's interesting. On mine in Netscape it seems to be looking for http://www.justhoroscopes.com/%5Bobject%20HTMLSelectElement%5D/AriesAries.htm, (been truncated by the system), and comes back with -
The requested URL /[object HTMLSelectElement]/AriesAries.htm was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.27 Server at www.justhoroscopes.com Port 80
Could it be a conflict on my PC?
Hey, nothing pervy about it, just good clean fun!
Ben
khalidali63
02-05-2003, 05:45 AM
This is strange.Where is the server that is serving these pages,if its on your pc,then it can not be ur pc because I get served from the same server.othrwise ...hunmmm
well how about uninstalling the NS and getting rid of all the exisitng folders that it creates and then re-instal it..just a suggest..
Khalid
ben456
02-05-2003, 05:58 AM
No, it's served from a third party host. I'll try from another PC and if it works do as you suggest and remove/reinstall Netscape.
Thanks, Ben