Need help getting a function to work in IE8

I am encountering problems with Internet Explorer 8 and was wondering if anyone might be able to help. More specifically, I have utilized some java code (that I picked up from one of the site point books) that is supposed to: allow or remove a message - (telling users who currently have their JavaScript disabled, that it needs to be turned on in order to utilize important website functions). The purpose of this being to have the message show up when a user has their browser’s JavaScript disabled, but at the same time removing the message so it does not show up when a user’s JavaScript is enabled.

This being accomplished through the use of the code shown below.


This aforementioned snippet of java code does work in Mozilla - but does not work in Internet explorer8 even though the JavaScript in that browser is in fact enabled (and certain other java functions do work). Was wondering if someone could provide guidance as to the best way of coding this function. I would really appreciate as detailed feedback (regarding the specific needed code) as you might feel so inclined to offer. Thanks.


Normally that is a good way of coding the function.

Is it possible to take a look at a page that allows us to experience the problem, so that the trouble and a potential solution may be found?

Thanks for getting back to me. I’m not sure which page info you refer to in your post - but I assume you are asking about my: “javascript.js” page. If this is the case, the only code on that page relevant to the function I’m trying to achieve is:
~ $(‘#nojava’).remove(); ~ (and I am using “core.js” as provided in one of the sitepoint books on java script and “jquery-1.4.min.js”)
As mentioned in my original post - this code works to remove the “java script needs to be enabled” message in mozilla - but not in IE(7 or 8). Let me know more specifically what I can provide for your complete understanding of this issue and I will provide it. Thanks.

There is nothing that seems to be wrong with the scripting code that you’ve shown to us here, which means that there is something else about the page that’s responsible for the issue.

A link to a web page that demonstrates the problem is the best thing that you can provide from here, so that we can diagnose the issue and come up with a solution.

Though the site is unfinished and rough - you could see the issue to which I refer at: < >Thanks again for your help.

If you want to tell people to enable JavaScript, don’t confuse them by referring to it as Java, which is something else entirely.

There are indicated script errors that are probably the cause of your script not running. Use the error console.

There are other scripting errors on your page, unrelated to what you posted about above, which are causing the scripting engine in IE8 to stop.

Your nojava message is also incorrect. Java is a completely different language from JavaScript.
Change your message to say JavaScript instead, otherwise you’ll just end up confusing people.