...

View Full Version : Javascript Not Showing In IE



ssstack
08-09-2008, 03:36 AM
Hello,

I've been working on the problem on this page for some time now and can't seem to solve it: http://sikhfaith.com/demo/bookmark

This page loads Javascript to help users bookmark the page. It shows up perfectly in Firefox 2.0. However, in Internet Explorer 7.0, the script apparently never loads and that part of the page remains blank.

The strange thing is that I had used the exact same script on a differently themed page on a different site, and it showed up perfectly in BOTH browsers that time. So apparently something is amiss just with this particular webpage, not the Javascript itself. But I can't figure out what would block the Javascript from displaying only in IE.

Any help on this confusing problem would be highly valued. I am no Javascript expert.

Thank you.

rangana
08-09-2008, 07:35 AM
It's because you did'nt close your comment.


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (document.all){
document.write('<A class="blue" HREF="javascript:history.go(0);" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.sikhism.com\');">');
document.write('Create Homepage</a>');
}
else if (document.getElementById){
document.write('<a href="http://www.sikhism.com" class="blue">Drag this link onto your Home button to make this your homepage.</a>');
}
else if (document.layers){
document.write('<b>Create Homepage:</b><br>- Go to <b>Preferences</b> in the <B>Edit</B> Menu.<br>- Choose <b>Navigator</b> from the list on the left.<br>- Click on the <b>"Use Current Page"</b> button.');
}
else {
document.write('<b>Create Homepage:</b><br>- Go to <b>Preferences</b> in the <B>Edit</B> Menu.<br>- Choose <b>Navigator</b> from the list on the left.<br>- Click on the <b>"Use Current Page"</b> button.');
}
</script>


See highlighted, you started it, but forgot to close. Also, the correct way for commenting JS for very old browsers is:


<script type="text/javascript">
<!-- // Begin Comment
JS syntax here
// End comment -->
</script>


Also note that language is a deprecated attribute. Use type (highighted in red) instead.

Hope that makes sense.

ssstack
08-09-2008, 10:44 AM
You are awesome and solved my problem. Thanks. It was so simple but because I did not know I had been spending my time looking elsewhere for the issue.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum