Changing the z-index with an OnClick

I am trying to change the z-index of a div when the user clicks on a link. I haven't been able to figure it out.
<style>
 div#mainContentCenter {
	margin-left: 30px;  	
	margin-top: 10px; 
	padding 12px;
	width: 770px;
	height: 500px;
	}
 div#blueLeftContent {
	 position: relative; 
	 width: 130px;
	 padding: 6px;
	 display: inline;
	 float: left;
	 border: 1px red solid;
	}
 div#rightMainContent {
	position: relative;
	width: 612px;
	padding: 6px;
	display: inline;
	float: right;
	border: 1px orange solid;
	}
	UL {
		margin-left: 10px;
	}
	P, LI, TD {
		font: 10px Verdana, Geneva, Arial, Helvetica, sans-serif;
		line-height: 12px;
	}
	
div#imageOne {
	border: 1px black solid;
	float: right;
	width: 150px;
	height: 150px;
	position: absolute;
	left: 450px;
	background-color: black;
}
div#imageTwo {
	border: 1px red solid;
	float: right;
	width: 150px;
	height: 150px;
	position: absolute;
	left: 400px;
	top: 100px;
	background-color: red;
}
div#imageThree {
	border: 1px blue solid;
	float: right;
	width: 150px;
	height: 150px;
	position: absolute;
	left: 450px;
	top: 200px;
	background-color: blue;
}
</style>
 
<!-- Header file -->
 
<!-- End Header File  -->
 
<div id="mainContentCenter">
	<div id="blueLeftContent">
    <p>Test</p>
    
    <ul>
    	<li><a href="Javascript:void(0);" onClick="Element.setStyle(imageOne, 'zIndex', 100);">Test 1</a></li>
        <li><a href="">Test 2</a></li>
        <li><a href="">Test 3</a></li>
        <li>Test 4</li>
    </ul>
    </div>
    <div id="rightMainContent">
    <p>Test Right</p>
    	<div id="imageOne">One</div>
        <div id="imageTwo">Two</div>
        <div id="imageThree">Three</div>
    </div>
</div>
 
<!-- Header file -->
 
<!-- End Header File  -->

Open in new window

pGustafsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

irf44zCommented:
Try this:

onClick="document.getElementById('imageOne').style.zIndex = '100';"
0
Shahzad Fateh AliWeb Solutions Architect & Technical Project Manager- VentureDive (Pvt) LtdCommented:
you can also create a function like

<script type="text/javascript">
    var changeZIndex = function(id,index){
        document.getElementById(id).style.zIndex = index;
    }
</script>

and Use it like

<a href="javascript:;" onClick="changeZIndex('imageOne',100)">Test 1</a>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pGustafsonAuthor Commented:
Worked Great Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.