SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Burlington, VT
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy ie6 javascript error: cant open page

    hi everyone
    i have this menu.js script (posted below) that is giving me this error in ie6 intermittently on any page

    Internet Explorer cannot open the internet site munstre.com/'whateverpage'.shtml

    operation aborted


    the error comes up even when the page is loaded

    this doesn't happen with menu.js disabled but I'm not good with js anymore so i am at a loss and realize i made a stupid decision with this menu.
    I've tried using just css for what i want to do but to no avail (though I've been mainly focusing on fixing what's there)

    the menu is an include and is located here munstre.com/menu.html

    any help would be greatly appreciated, thank you!


    ok i cant post the code because of url's so its located here munstre.com/js/menu.js

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE often does not open JS files directly in the browser, you should use Firefox to view the source code for JS scripts.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Burlington, VT
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    //MENU ITEMS
    var menu1=new Array()
    menu1[0]='<a href="munstre.com/mini.shtml">Mini Boxes</a>'
    menu1[1]='<a href="munstre.com/stand.shtml">Standard</a>'
    menu1[2]='<a href="munstre.com/spec.shtml">Specialty</a>'
    
    
    var menu2=new Array()
    menu2[0]='<a href="munstre.com/buttons.shtml">buttons</a>'
    menu2[1]='<a href="munstre.com/magnets.shtml">magnets</a>'
    menu2[2]='<a href="munstre.com/keychain.shtml">keychains</a>'
    
    
    var menu3=new Array()
    menu3[0]='<a href="munstre.com/mount.shtml">mounted</a>'
    menu3[1]='<a href="munstre.com/unmount.shtml">unmounted</a>'
    
    var menu4=new Array()
    menu4[0]='<a href="munstre.com/about.shtml">about</a>'
    menu4[1]='<a href="munstre.com/contact.shtml">contact</a>'
    		
    var menu5=new Array()
    menu5[0]='<a href="munstre.com/tshirts.shtml">t-shirts</a>'
    
    		
    var menuwidth='165px' //default menu width
    var menubgcolor=''  //menu bgcolor
    var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
    var hidemenu_onclick="yes" //hide menu when user clicks within menu?
    
    /////No further editting needed
    
    var ie4=document.all
    var ns6=document.getElementById&&!document.all
    
    if (ie4||ns6)
    document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
    
    function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }
    
    
    function showhide(obj, e, visible, hidden, menuwidth){
    if (ie4||ns6)
    dropmenuobj.style.left=dropmenuobj.style.top="-500px"
    if (menuwidth!=""){
    dropmenuobj.widthobj=dropmenuobj.style
    dropmenuobj.widthobj.width=menuwidth
    }
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
    obj.visibility=visible
    else if (e.type=="click")
    obj.visibility=hidden
    }
    
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function clearbrowseredge(obj, whichedge){
    var edgeoffset=0
    if (whichedge=="rightedge"){
    var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
    dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
    edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
    }
    else{
    var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
    var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
    dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
    edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
    }
    }
    return edgeoffset
    }
    
    function populatemenu(what){
    if (ie4||ns6)
    dropmenuobj.innerHTML=what.join("")
    }
    
    
    function dropdownmenu(obj, e, menucontents, menuwidth){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)
    
    if (ie4||ns6){
    showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
    
    dropmenuobj.x=getposOffset(obj, "left")
    dropmenuobj.y=getposOffset(obj, "top")
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
    
    return clickreturnvalue()
    }
    
    function clickreturnvalue(){
    if (ie4||ns6) return false
    else return true
    }
    
    function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
    }
    
    function dynamichide(e){
    if (ie4&&!dropmenuobj.contains(e.toElement))
    delayhidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhidemenu()
    }
    
    function hidemenu(e){
    if (typeof dropmenuobj!="undefined"){
    if (ie4||ns6)
    dropmenuobj.style.visibility="hidden"
    }
    }
    
    function delayhidemenu(){
    if (ie4||ns6)
    delayhide=setTimeout("hidemenu()",disappeardelay)
    }
    
    function clearhidemenu(){
    if (typeof delayhide!="undefined")
    clearTimeout(delayhide)
    }
    
    if (hidemenu_onclick=="yes")
    document.onclick=hidemenu

  4. #4
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by nszumowski View Post
    hi everyone
    i have this menu.js script (posted below) that is giving me this error in ie6 intermittently on any page

    Internet Explorer cannot open the internet site munstre.com/'whateverpage'.shtml

    operation aborted
    This is a well-known (and searchable) I.E. issue - make sure that you don't nest the script inside another element (except <BODY>) and ensure that the markup is valid: http://validator.w3.org .
    Tab-indentation is a crime against humanity.

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Burlington, VT
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah i just realized it was searchable last night via "operation aborted" as the other text brought up a slew of unrelated ie issues. though what i have found is in reference to DOM, which i know nothing about, so i have no way to interpret the current solutions. maybe i just need a couple weeks to learn what DOM is...

    it validated fine previously under strict but does that validate javascript? seems my new meta/analytics tags are pretty off though... :/ and it's nested in the head tag with the rest of js and css files, should i move them all into body?

    thanks for the response!

  6. #6
    SitePoint Member
    Join Date
    Jul 2008
    Location
    Burlington, VT
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, well through all my searching for this "well known" albeit vague error, considering the variables, i still have no idea what DOM is and don't have the time nor skills to learn it.

    BUT i found that if i put my menu.js right before </body> the error goes away, however it screws up firefox and ie7. they want it on top it seems or my menu gets all crazy

    can i have a conditional statement with the rest of my css and js links on top saying if ie6 DONT use the js and on the bottom of the page a conditional allowing me to use it? so the dom is loaded after everything else...

    so basically ill have two instances of menu.js but would like the top hidden from ie6

    top:
    Code:
    <script src="js/menu.js" type="text/javascript"></script>
    <!--[if IE 7]> <script src="js/menu.js" type="text/javascript"></script> <![endif]-->
    <!--[if IE 7]> <style type="text/css">@import "css/default.css";</style> <![endif]-->
    </head>
    bottom near end body
    Code:
    <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="css/ie6.css" /> <![endif]-->
    <!--[if IE 6]> <script src="js/menu.js" type="text/javascript"></script> <![endif]-->
    </body>
    you can see source here
    munstre.com/index.shtml

    thanks guys!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •