Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Arrow how to add a textbrowser alternative to this js menu?

    hello,
    my website tag7.ch consists of an html entry page and the main website. on the entry page there is a js menu that opens the main webpage in a new window in full screen.

    I love this function but browser that don´t allow js doesn´t have a chance to enter the main website.

    Do you know how the script has to be changed that there will be displayed some simple html text-links for non-js browser?

    greetings from switzerland,
    marcus
    www.tag7.ch

    Code:
    <head> 
    <SCRIPT LANGUAGE="JavaScript">
    function openPage(page, width, height, sBar) {
    var w, h;
    var agt = navigator.userAgent.toLowerCase();
    var isNetscape = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var isMac = (navigator.appVersion.indexOf("Mac") != -1);
    
    w = (screen.availWidth ? screen.availWidth : 800);
    h = (screen.availHeight ? screen.availHeight : 600);
    
    var winObj = window.open("/_mini/"+page,"mini","left="+Math.round((w-width)/2)+",top="+Math.round((h-height)/2)+",width="+width+",height="+height+",fullscreen=no,scrollbars="+sBar);
    }
    function Pop(page){
    switch(page){
    case "test":
    openPage("test.html", 350, 550, "yes");
    break;
    
    default:
    break;
    }
    }
    
    
    var hwin= null;
    var fwin = null;
    
    function enterFoo(){
    openFullScreen();
    //if (screen.width > 1024) openPopup();
    //else openFullScreen();
    //location.href = "thanks.html";
    }
    function enterFoo_en(){
    openFullScreen_en();
    //if (screen.width > 1024) openPopup();
    //else openFullScreen();
    //location.href = "thanks.html";
    }
    function openPopup(){
    var popwidth=1024
    var isMac = (navigator.appVersion.indexOf("Mac") != -1);
    var winl = (screen.width-popwidth)/2;
    var wint = (screen.height-700)/2;
    if (isMac) wint += 30; // 20
    else {
    wint -= 20;
    winl -= 10;
    }
    settings='height='+700+',width='+popwidth+',top='+wint+',left='+winl+',toolbar=no, location=no, menubar=no, status=no, scrollbars=yes, resizable=no'
    fwin=window.open('main_de.html','.:Tag7:.',settings)
    if(parseInt(navigator.appVersion) >= 4){fwin.window.focus();}
    } 
    function openFullScreen() { 
    var width, height;
    var agt = navigator.userAgent.toLowerCase();
    var isNetscape = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var isMac = (navigator.appVersion.indexOf("Mac") != -1);
    
    width = (screen.availWidth ? screen.availWidth : 800);
    height = (screen.availHeight ? screen.availHeight : 600);
    
    height -= 35; // -20 
    
    if (isMac) height += 30; // 20
    else width -= 10;
    
    url = "main_de.htm";
    
    var winObj = window.open(url,"Tag7","left=0,top=0,width=" + width + ",height=" + height + ",fullscreen=no, scrollbars=auto");
    if(winObj && isMac && winObj.moveTo && winObj.resizeTo) {
    winObj.moveTo(0, 0);
    winObj.resizeTo((width), height);
    winObj.focus();
    }
    
    }
    function openFullScreen_en() { 
    var width, height;
    var agt = navigator.userAgent.toLowerCase();
    var isNetscape = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var isMac = (navigator.appVersion.indexOf("Mac") != -1);
    
    width = (screen.availWidth ? screen.availWidth : 800);
    height = (screen.availHeight ? screen.availHeight : 600);
    
    height -= 35; // -20 
    
    if (isMac) height += 30; // 20
    else width -= 10;
    
    url = "main_en.htm";
    
    var winObj = window.open(url,"Tag7","left=0,top=0,width=" + width + ",height=" + height + ",fullscreen=no, scrollbars=auto");
    if(winObj && isMac && winObj.moveTo && winObj.resizeTo) {
    winObj.moveTo(0, 0);
    winObj.resizeTo((width), height);
    winObj.focus();
    }
    
    }
    
    function updateFlash(){
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    }
    
    </SCRIPT>
    
    </head>
    and

    Code:
    <body leftmargin="0" topmargin="0" bgcolor="#ffffff" marginheight="0" marginwidth="0">
    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
    <tbody><tr>
    <td align="center" valign="middle">
    <br>&nbsp;
    <br>&nbsp;
    <br>&nbsp;
    <br>&nbsp;
    <br>&nbsp;
    <br><img src="start_bild.jpg" usemap="#Map" border="0" height="379" width="265" alt="hochzeitsfotograf zürich schweiz">
    <br>&nbsp;
    <br>&nbsp;
    <br>&nbsp;
    <p></p> 
    </td>
    </tr>
    </tbody></table>
    
    
    <map name="Map">
    <area shape="rect" coords="41,332,222,349" href="http://blog.tag7.de/" target="_blank">
    <area shape="rect" coords="41,261,222,278" href="javascript:enterFoo();">
    <area shape="rect" coords="41,297,222,314" href="javascript:enterFoo_en();">
    </map>
    
    </body>

  • #2
    New Coder
    Join Date
    Dec 2004
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Code:
    <div id="nojs"><A>your links etc</a><div> 
    
    <script>
    document.getElementById(nojs).innerHtml = "";
    </script>
    Try something like that. Might need to format the code properly. You place you links in a div, and if javascript is available, it will clear them.

  • Users who have thanked bunion for this post:

    _Marcus (01-28-2009)

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    hello bunion,
    thanks for your reply!

    I tried but it doesn´t work. The html links are displayed even when my browser supports js. Where is the bug?

    cheers, Marcus

    [edit]
    this is the result. the first 3 text links should not be visable on js browsers
    http://tag7.ch/index_new.htm
    Last edited by _Marcus; 01-28-2009 at 11:51 AM.

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Try to surround the text menu with noscript tag:
    Code:
    <noscript>
    Contents within this block are viewed only when users has JS disabled.
    </noscript>
    Also, it's better to design your page without JS yet, then add JS to add some interaction on your page.

    Good links:
    http://onlinetools.org/articles/unobtrusivejavascript/
    http://www.alistapart.com/articles/u...iveenhancement
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • The Following 2 Users Say Thank You to rangana For This Useful Post:

    oesxyl (01-28-2009), _Marcus (01-28-2009)

  • #5
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    @ rangana
    thanks for your great and simple solution! it works just the way I needed it


    cheers, marcus


  •  

    Posting Permissions

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