PDA

Click to See Complete Forum and Search --> : image map problem in Netscape 6


msimmons
Jan 10th, 2002, 08:56 AM
could anyone look at the source of this and tell me why it dosent work for netscape 6? www.smallchichotels.com (http://www.smallchichotels.com) (click on Hotels & Resorts) . It worked for previous versions. This was built before I worked here and I'm not much of a netscape user or programmer.
thanks
michael

msimmons
Jan 10th, 2002, 01:20 PM
this page is an image map of the world where the user clicks on a spot on the map and a list of towns pops up. in netscape 6 the user clicks and nothing happens. I think this may have something to do with divs vs layers. Like I said in the prev post, im not much of a netscape person but I am assuming that the layers are for use in netscape (4.7 and lower?).
thanks in advance
michael

progressive
Jan 11th, 2002, 03:25 AM
The problem is that the code is checking for a browser named nestacpe and using layersif it finds one! netscape 6 uses divs in the same way as IE apart from you use

docuemnt.getElemeniById('div_name').style.visibilty="hidden";

to access elemnts of the webpage.

so instead of doing the following to check for browser


if(navigator.appName == "Netscape"){

} else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("MSIE 4") != -1) {

}


use


if (document.layers){
//netscape 4 and below
//use layers
alert("netscape 4 and below");
} else if(document.all && !document.getElementById) {
//ie 3 and below
//use document.all and divs
alert("ie 3 and below");
}else if (document.getElementById){
//netscape 6
//ie 4 and above
//use divs and document.getElementById
alert("netscape 6 or ie 4+");
}else{
//****e browser go away!
alert ("go away");
}


now youll have to rewrite all those scripts....no wonder web development is so time consuming! ;)

msimmons
Jan 11th, 2002, 09:24 AM
thx :)
I found that in a book last night and you (and the code w/its antiquated "if browser name=") confirmed it.
New problem:
who does netscape 6 deal with getting window size? This code segment never gets inside the blue if in NS6 so I was thinking maybe that was the problem.


if(document.getElementById){
eval("window.div" + varRegion + ".style.visibility = \"visible\"");
varMenuBottom = document.body.<%= BodyHeightProp %>Height - (eval("window.div" + varRegion + ".<%= BodyHeightProp %>Height") + eval("window.div" + varRegion + ".offsetTop"));
varMenuBottom = varMenuBottom.toString()
if(varMenuBottom.indexOf("-") >= 0){
if(document.body.<%= BodyHeightProp %>Height < eval("window.div" + varRegion + ".<%= BodyHeightProp %>Height")) {
eval("window.div" + varRegion + ".style.top = 0")
} else {
eval("window.div" + varRegion + ".style.top = var" + varRegion + "Top - varMenuBottom.replace(\"-\", \"\")")
}
}
} else {
hideMenus();
eval("document.layers.div" + varRegion + ".visibility=\"show\"");
varMenuBottom = (eval("window.innerHeight - (document.layers.div" + varRegion + ".clip.height + document.layers.div" + varRegion + ".top)"))
varMenuBottom = varMenuBottom.toString()
if(varMenuBottom.indexOf("-") >= 0){
if(eval("document.layers.div" + varRegion + ".clip.height") > window.innerHeight){
eval("document.layers.div" + varRegion + ".top = 0")
} else {
eval("document.layers.div" + varRegion + ".top = var" + varRegion + "Top - varMenuBottom.replace(\"-\", \"\")")
}
}
}

Thanks in advance,
Michael

progressive
Jan 11th, 2002, 10:00 AM
hold on a minute, whats this

<%= BodyHeightProp %>

is it vbscript?? if so are you using asp?

msimmons
Jan 11th, 2002, 10:59 AM
looks like that variable gets set at the top of the page

If Instr(1, Request.ServerVariables("HTTP_USER_AGENT"), "MSIE 5") = 0 Then
ShowFunctionType = "Click"
Else
ShowFunctionType = "MouseOver"
End If
If Instr(1, Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") = 0 Then
BodyFunctionType = "Focus"
Else
BodyFunctionType = "MouseUp"
End If
If Instr(1, Request.ServerVariables("HTTP_USER_AGENT"), "Win") = 0 Then
BodyHeightProp = "scroll"
Else
BodyHeightProp = "offset"
End If

how would you suggest to fix this one? (yes, it has some asp :)).
thanks
michael

progressive
Jan 11th, 2002, 11:21 AM
so

If Instr(1, Request.ServerVariables("HTTP_USER_AGENT"), "Win") = 0 Then
BodyHeightProp = "scroll"
Else
BodyHeightProp = "offset"
End If


when the above test is done BodyHeightProp is set to either

"scroll" or "offset"

I'm guessing that which ever one it's trying to use is the wrong one to use in netscape 6 (not being familiar with vbscript, I don't know what the above tests are doing).

type javascript: in the location bar to find out what error is occuring on that particular page(launches the javascript debugger).

You will also need to find out how netscape 6 finds the scrollbar position, or if indeed it can at all??

msimmons
Jan 11th, 2002, 01:14 PM
thanks for all the help :) I posted a new post in the ASP forum reguarding that code chunk.
Michael