Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browser prob with Layers

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi everybody, does anyone know why the below program works in IE 5 and not in NetCRAP 4.7 or 6?


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script LANGUAGE=&quot;JavaScript&quot;>// Fontasia Design -->

function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf(&quot;?&quot;))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); return x;
}

function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->

function letsgo(){
if (document.marketentry.bactivity.value == &quot;other&quot;)
{MM_showHideLayers('Layer1','','show');}
else
{MM_showHideLayers('Layer1','','hide');}
}
</script>

</head>

<body bgcolor=&quot;#FFFFFF&quot;>

<div id=&quot;Layer1&quot; style=&quot;position:absolute; left:399px; top:107px; width:160px; height:112px; z-index:1; visibility: hidden&quot;>xcvxsdfs</div>

<p> </p>
<form name=&quot;marketentry&quot; method=&quot;post&quot; action=&quot;&quot;>
<select name=&quot;bactivity&quot; onChange=&quot;letsgo();&quot;>
<option>fsddfsfsddds</option>
<option>fsd</option>
<option>fs</option>
<option>fs</option>
<option>fsf</option>
<option value=&quot;other&quot;>other</option>
</select>
</form>
<p> </p>
</body>
</html>
 
dear kikaikai,
div is a IE+ only tag and netscape's equivalent for it is <layer> tag...so in ur script u put a browser check script

i.e if document.all it is internet explorer
if document.layers it is netscape

and depending on the browser u tailor the code

take care
regards
R.Subramanian
 
hi
yeah, but if u want divs 2 work in netscrap 4x, u shuld use <style>..</style> definition instead of inline style=&quot;..&quot;
& double there visibility property (& others that are not the same in nn & ie; browser that not support any property wuld just ignore it, so there wont be any errors (shuldnt be)):
<style>
<!--
div#Layer1{
..
visibility:hidden;
visibility:hide;
..
}
-->
</style>

regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top