Results 1 to 3 of 3

Thread: How to change Javascript to work with IE

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2012
    Posts
    3

    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
  •  



Click Here to Expand Forum to Full Width