/    Sign up×
Community /Pin to ProfileBookmark

getElementById for z-indexing of image problem

Hi!
i am new to javascript.i am trying to creat an photo gallery
in which image will appear one over another on mouse hover.but the code is not working.
i did

[CODE]document.getElementById(“hovers”).span.img.style.z-index=”2″;[/CODE]

but nothing seems to work.? .can any one suggest me how to fix this?
my code is here——

[CODE]<!doctype html>
<html>
<head>

<meta charset=”utf-8″>
<title>Untitled Document</title>

<script language=”javascript” type=”text/javascript”>
function changeindex() {

document.getElementById(“hovers”).span.img.style.z-index=”2″;
}

</script>
<style>
*{margin:0px;padding:0px;}

ul{list-style-type:none;}
</style>
</head>

<body>
<ul >
<li style=”position:relative;” >
<img src=”lom.jpg” width=”200px” height=”200px” style=”position:absolute;top:0px;” id=”hovers” onMouseOver=’changeindex();’/>
<span style=”position:absolute;left:300px;” ><img src=”lom.jpg” width=”400px” height=”400px” /></span>
</li>
</ul>
<img src=”images4.jpg” width=”400px” height=”400px” style=”position:relative;left:342px;top:0px;” />

</body>

</html>[/CODE]

to post a comment
JavaScript

2 Comments(s)

×

Success!

Help @alzami spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...