PDA

View Full Version : Condition to handle Netscape 4 browsers


florida
07-19-2002, 06:18 PM
Now that I found out below script doesnt work on Netscape 4 and does work in IE, how can I put something in where it wont show "Javascript error" message on the Netscape browser pages? So basically it will bypass the overAndOut function if it is a Netscape 4 browser but will use the overAndOut function if it is a IE browser.




<a href="myfile.htm" onMouseOver="javascript:overAndOut(this);window.status='MyText...';return true;"
onMouseOut="javascript:overAndOut(this);window.status='';return true;"
STYLE="font-size:8pt;">
CHANGE LINK TEXT COLOR ON MOUSE OVER HERE</a>


<script name="javascript">
function overAndOut(oEl) {
if (oEl.style.color == 'blue')
oEl.style.color = 'orange';
else oEl.style.color = 'blue';
}
</script>


I was thinking something like this?

var ns4 = netscape browser ???not sure to id netscape 4 browser

if (! ns4)
{
........


Please advise how I would do this?

tamienne
07-19-2002, 07:49 PM
NS4=(document.layers);

function overAndOut(oEl) {
if (!NS4) {
if (oEl.style.color == 'blue')
oEl.style.color = 'orange';
else
oEl.style.color = 'blue';
}
}

florida
07-19-2002, 08:32 PM
Thanks for your answer! It now works.