...

View Full Version : Javascript file not running in IE7



jasonawatkins
08-30-2007, 03:43 PM
Hello all. I am new around here and to coding in general, so please keep in mind that I'm a complete noob. With that being said, I am working on a site and decided to use vertical javascript menus. I found this script http://www.javascriptkit.com/script/script2/verticalmenu.shtml and found it to be to my liking. So, I implemented it into my code and then the problems started. Everything works perfect in FF and Safari, but Internet Explorer will not run the .js file for some reason. At least that's where I think the problem is.

Originally I had the js script tag in the heading as the page describes, but IE would not load anything on the page. I moved the script tag to the bottom just above the /body tag and now it will load the entire page, but the the script itself. FF and Safari have worked irregardless.

Does anyone have any suggestions? I am not opposed to using FF or Safari, I would just rather use IE. I would appreciate any help and will answer any questions or provide anything anyone needs to help me.

Thanks!

abduraooft
08-30-2007, 03:45 PM
Can you post a link to your page before modification?

jasonawatkins
08-30-2007, 03:48 PM
Oh, I forgot to mention, when I try to load the page in IE7, the ActiveX bar appears at the top gives it generic message about blocking scripts. I tell it to run blocked scripts and nothing happens. Just thought I would mentioned that.

Also, I have tried it on two different machines with IE7 and one machine with IE6 and they all do the same thing. so, I assume it is solely an IE problem.

jasonawatkins
08-30-2007, 03:50 PM
Well, that's a problem. Currently, I only run the page locally. I currently do not have a host or anything. I was waiting till I at least had some content for people to see. Any ideas?

abduraooft
08-30-2007, 03:56 PM
Then post the code of your current page. (use wrap [code] option)

jasonawatkins
08-30-2007, 04:00 PM
Okay, here is what exists of my mainpage (yes, it's mostly empty). I hope I'm posting this right.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ansi" />
<title>Final Fantasy</title>
<link rel="stylesheet" type="text/css" href="styles/main.css" />
<link rel="stylesheet" type="text/css" href="styles/verticalmenu.css" />
</head>

<body>
<table id="main">
<tr>
<td class="Themes" colspan="2">
<table id="mt1">
<tr>
<td>
Final Fantasy
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="Themes">
<ul id="verticalmenu" class="glossymenu">
<li class="games">&nbsp;</li>
<li class="systems">Nintendo</li>
<li class="games"><a href="ffi/ffimain.html">Final Fantasy I</a>
<ul>
<li><a href="ffi/maps.html">Maps</a></li>
<li><a href="ffi/monsters.html">Monsters</a></li>
<li><a href="ffi/walkthrough000.html">Walkthrough</a></li>
</ul>
</li>
<li class="games"><a href="ffii/ffiimain.html">Final Fantasy II</a></li>
<li class="games"><a href="ffiii/ffiiimain.html">Final Fantasy III</a></li>
<li class="systems">Super Nintendo</li>
<li class="games"><a href="ffiv/ffivmain.html">Final Fantasy IV</a></li>
<li class="games"><a href="ffv/ffvmain.html">Final Fantasy V</a></li>
<li class="games"><a href="ffvi/ffvimain.html">Final Fantasy VI</a></li>
<li class="games"><a href="ffmq/ffmqmain.html">Final Fantasy MQ</a></li>
<li class="systems">Playstation</li>
<li class="games"><a href="ffvii/ffviimain.html">Final Fantasy VII</a></li>
<li class="games"><a href="ffviii/ffviiimain.html">Final Fantasy VIII</a></li>
<li class="games"><a href="ffix/ffixmain.html">Final Fantasy IX</a></li>
<li class="games"><a href="fft/fftmain.html">Final Fantasy T</a></li>
<li class="games">&nbsp;</li>
</ul>
</td>
<td>
<table id="rn1">
<tr>
<td>
<p>&nbsp;</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="Themes" colspan="2">
<table id="ft1">
<tr>
<td>
Questions, comments, or suggestions? I welcome all! Please feel free to contact me <a id="email" href="mailto:finalfantasysanctum@gmail.com">here.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript" src="scripts/verticalmenu.js">

/***********************************************

* CSS Vertical List Menu- by JavaScript Kit (www.javascriptkit.com)
* Menu interface credits: http://www.dynamicdrive.com/style/csslibrary/item/glossy-vertical-menu/
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more

***********************************************/

</script>
</body>

</html>

jasonawatkins
08-30-2007, 04:03 PM
And here is the Javascript file referenced.


var menuids=new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
var submenuoffset=-2 //Offset of submenus from main menu. Default is -2 pixels.

function createcssmenu(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
for (var t=0; t<ultags.length; t++){
var spanref=document.createElement("span")
spanref.className="arrowdiv"
spanref.innerHTML="&nbsp;&nbsp;"
ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.left=this.parentNode.offsetWidth+submenuoffset+"px"
this.getElementsByTagName("ul")[0].style.display="block"
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none"
}
}
}
}


if (window.addEventListener)
window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu)

abduraooft
08-30-2007, 04:21 PM
Its working for me in IE6.Paste the <script> inside <head>. as per their direction, and be sure that the path of the JS file,CSS and images are all correct according to your html code.

jasonawatkins
08-30-2007, 04:35 PM
Ah, I figured it out. What I pasted up here was the original code and not the current I was working on. I only had a few minor changes, but one of the was that I had contracted the script tag to <script xxxx /> instead of using opening and closing script tags. I changed it back and now it works in IE. Who knows?

Thanks for your help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum