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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JS z-index change - obect expected

Status
Not open for further replies.

mwhite

Vendor
Feb 18, 2000
3
0
0
US
Hi,

I am getting an "object expected" error on the button line in the following code (this is supposed to raise the z-index value of the "overlay" layer when the button is clicked. It doesn't work...):

<html>
<head>

<STYLE>
#base { position: absolute;left:200;top:0;z-index:1}
#course { position: absolute;left:200;top:0;z-index:0 }
</STYLE>

<div id=&quot;base&quot;>
<img src=&quot;baseimage.jpg&quot; height=639 width=639>
</div>

<div id=&quot;course&quot;>
<img src=&quot;courseimage.jpg&quot; height=639 width=639>
</div>

<script type=&quot;text/javascript&quot;>
function check(form)
{
if (course.checked)
{
if (document.layers)
document.layer.zIndex = 2;
else if (document.all)
document.all.layer.style.zIndex = 2;
else if (document.getElementById)
document.getElementById('layer').style.zIndex = 2;
}

</script>

</head>
<body>
<form NAME=&quot;viewoverlay&quot;><input TYPE=CHECKBOX NAME=&quot;course&quot; value=&quot;Course Area&quot; >Course
Area
<br><input type=&quot;button&quot; value=&quot;View&quot; name=&quot;msw&quot; onClick=&quot;check(this.form)&quot;></form>
</body>
</html>



Any help?

Matt
 
Thanks LakshmiKiran...

I fixed that and a couple of silly things I did, and the &quot;object error&quot; is gone, but the z-index change does not yet work. Here is the current code:

<html>
<head>
<STYLE>
#base { position: absolute;left:200;top:0;}
#course { position: absolute;left:200;top:0; }
</STYLE>

<div id=&quot;base&quot; style=&quot;z-index:1&quot;>
<img src=&quot;image1.jpg&quot; height=639 width=639>
</div>

<div id=&quot;course&quot; style=&quot;z-index:0&quot;>
<img src=&quot;image2.jpg&quot; height=639 width=639>
</div>

<script type=&quot;text/javascript&quot;>
function check()
{
if (course.checked)

{
if (document.layers)
document.course.zIndex = 2;
else if (document.all)
document.all.course.style.zIndex = 2;
else if (document.getElementById)
document.getElementById('course').style.zIndex = 2;
}
}

</script>

</head>
<body>
<form NAME=&quot;viewoverlay&quot;><input TYPE=CHECKBOX NAME=&quot;course&quot; value=&quot;Course Area&quot; >Course
Area
<br><input type=&quot;button&quot; value=&quot;View&quot; name=&quot;msw&quot; onClick=&quot;check()&quot;></form>
</body>
</html>


Thanks for any insight...

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top