Run javascript in IE 9 or newer

Run javascript in IE 9 or newer

by Dean Leggo -
Number of replies: 1

I've made a script that does not work in IE8 or lower because the browsers do not support the javascript calls and css in it. The script works fine in Firefox, Chrome, Internet Explore 9 and 10. I added the script to the end of a label in a course so when the page loads the script will run. The script is designed to only effect what is in the label.

To stop it stuffing up in IE8 or lower this is the code I wrote for a label.

<div id="run-script-to-this">
**normal HTML code for label**
</div>

<!--[if (!IE)|(gt IE 8) ]>
<script type="text/javascript">// <![CDATA[
**javascript code to effect label**
// ]]></script>
<![endif]-->

But this completely destroys the script in all browsers. What am I doing wrong?

I'm running Moodle 2.3.2

Average of ratings: -
In reply to Dean Leggo

Re: SOLVED Do not run javascript in IE 8 or older

by Dean Leggo -

I just found this website and it was just a syntax error tongueout

<div id="run-script-to-this">
**normal HTML code for label**
</div>

<!--[if (!IE)|(gt IE 8) ]>-->
<script type="text/javascript">// <![CDATA[
**javascript code to effect label**
// ]]></script>
<!--<![endif]-->