|
-
Nov 6th, 2012, 05:46 PM
#1
Thread Starter
New Member
How to change Javascript to work with IE
Can someone please tell me how to fix the code below so that it works with IE. It currently works with Chrome and Firefox. Thanks.
<style type="text/css">
.highlight{
background-color: orange;
color: white;
}
</style>
<script type="text/javascript">
function createListener(){
document.addEventListener('click', function(event){
var element=event.target;
if(element!==document.body){
if(element.className===''){
element.className='highlight';
} else {
element.className='';
}
}
}, false);
}
</script>
<body onload="createListener()">
Last edited by cbanks; Nov 7th, 2012 at 10:57 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|