www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Simple TEXT if browser has no JavaScript...?

  1. #1
    Join Date
    Sep 2012
    Location
    Detroit
    Posts
    6

    resolved [RESOLVED] Simple TEXT if browser has no JavaScript...?

    Hey everyone, how's it going?

    I need a little help to crib a bit of code from one Javascript to another. My boss found this Flash based page-curl *.js file he wants on our site, and so far it's working fine, but I don't like the default behavior when it runs in a browser with no Flash enabled. So I found another script that does what I need, but can't seem to figure out exactly how to extract just the part I need for insertion into the first script...

    I know this is probably a very simple thing and a dumb question, LOL, but plz bear with me as I'm just a 'designer' really and still a beginner when it comes to actual coding

    What I'd like to have happen in browsers with no Flash is just to have "no flash" text placed on the page where the Flash content would normally go. We don't want the "alert" bar or prompts to download or install Flash or any of that other stuff -- we figure anyone in this day and age who has Flash OFF probably has it that way for a reason, and we don't want to bother them with any of that stuff.

    So, here's the code I found that does that, from the second script...

    Code:
        // Check if flash exists/ version matched
        if (hasReqestedVersion) {  
            AC_FL_RunContent(
              "src", pagearBigSwf+'?'+ queryParams,
              "width", bigWidth,
              "height", bigHeight,
              "align", "middle",
              "id", "bigSwf",
              "quality", "high",
              "bgcolor", "#FFFFFF",
              "name", "bigSwf",
              "wmode", "transparent",
              "allowScriptAccess","always",
              "type", "application/x-shockwave-flash",
              'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
              "pluginspage", "http://www.adobe.com/go/getflashplayer"
            );
        } else {  // otherwise do nothing or write message ... 
          document.write('<div style="font:bold 9px Arial; color:#FF4444; text-align:right;">[no flash]</div>'); // non-flash content 
        }
    ...and here's the full code of the page-peel script, which I want to add the above to...


    Code:
    var jaaspeel = new Object();
    
    jaaspeel.ad_url = escape('http://www.blucigs.com/');
    
    jaaspeel.small_path = 'peel-small.swf';
    jaaspeel.small_image = escape('peel-small.jpg');
    jaaspeel.small_width = '100';
    jaaspeel.small_height = '100';
    jaaspeel.small_params = 'ico=' + jaaspeel.small_image;
    
    jaaspeel.big_path = 'peel-big.swf';
    jaaspeel.big_image = escape('peel-big.jpg');
    jaaspeel.big_width = '650';
    jaaspeel.big_height = '650';
    jaaspeel.big_params = 'big=' + jaaspeel.big_image + '&ad_url=' + jaaspeel.ad_url;
    
    function sizeup987(){
    	document.getElementById('jcornerBig').style.top = '0px';
    	document.getElementById('jcornerSmall').style.top = '-1000px';
    }
    
    function sizedown987(){
    	document.getElementById("jcornerSmall").style.top = "0px";
    	document.getElementById("jcornerBig").style.top = "-1000px";
    }
    
    jaaspeel.putObjects = function () {
    // <jcornerSmall>
    document.write('<div id="jcornerSmall" style="position:absolute;width:'+ jaaspeel.small_width +'px;height:'+ jaaspeel.small_height +'px;z-index:9999;right:0px;top:0px;">');
    // object
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
    document.write(' id="jcornerSmallObject" width="'+jaaspeel.small_width+'" height="'+jaaspeel.small_height+'">');
    // object params
    document.write(' <param name="allowScriptAccess" value="always"/> ');
    document.write(' <param name="movie" value="'+ jaaspeel.small_path +'?'+ jaaspeel.small_params +'"/>');
    document.write(' <param name="wmode" value="transparent" />');
    document.write(' <param name="quality" value="high" /> ');
    document.write(' <param name="FlashVars" value="'+jaaspeel.small_params+'"/>');
    // embed
    document.write('<embed src="'+ jaaspeel.small_path + '?' + jaaspeel.small_params +'" name="jcornerSmallObject" wmode="transparent" quality="high" width="'+ jaaspeel.small_width +'" height="'+ jaaspeel.small_height +'" flashvars="'+ jaaspeel.small_params +'" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
    document.write('</object></div>');
    document.write('</script>');
    // </jcornerSmall>
    // <jcornerBig>
    document.write('<div id="jcornerBig" style="position:absolute;width:'+ jaaspeel.big_width +'px;height:'+ jaaspeel.big_height +'px;z-index:9999;right:0px;top:0px;">');
    // object
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
    document.write(' id="jcornerBigObject" width="'+ jaaspeel.big_width +'" height="'+ jaaspeel.big_height +'">');
    // object params
    document.write(' <param name="allowScriptAccess" value="always"/> ');
    document.write(' <param name="movie" value="'+ jaaspeel.big_path +'?'+ jaaspeel.big_params +'"/>');
    document.write(' <param name="wmode" value="transparent"/>');
    document.write(' <param name="quality" value="high" /> ');
    document.write(' <param name="FlashVars" value="'+ jaaspeel.big_params +'"/>');
    // embed
    document.write('<embed src="'+ jaaspeel.big_path + '?' + jaaspeel.big_params +'" id="jcornerBigEmbed" name="jcornerBigObject" wmode="transparent" quality="high" width="'+ jaaspeel.big_width +'" height="'+ jaaspeel.big_height +'" flashvars="'+ jaaspeel.big_params +'" swliveconnect="true" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
    document.write('</object></div>');
    // </jcornerBig>
    setTimeout('document.getElementById("jcornerBig").style.top = "-1000px";',1000);
    }
    jaaspeel.putObjects();
    Thanks in advance for any help with this... much appreciated

    -John C.

  2. #2
    Join Date
    Sep 2012
    Location
    Detroit
    Posts
    6
    {Edit} UPDATE

    Whoops... looks like I posted that too soon, LOL

    I somehow managed last night to put it together by myself, seems to be working okay so far.

    However, not sure if the way I did this is really quite correct or not. Maybe just cut and pasting like this could introduce some other kind of error or something?

    If any of y'all could quickly take a look at my code and let me know if anything seems to be WRONG, I'd appreciate a quick check on this. Thanks


    Code:
    /*   New Page-Peel, With Simple Flash-Disabled Text   */ 
    /*   Uses flashver.js Flash version checking script   */ 
    
    // Flash check vars 
    var requiredMajorVersion = 6;
    var requiredMinorVersion = 0;
    var requiredRevision = 0;
    
    var pagepeel = new Object();
    
    pagepeel.ad_url = escape('http://www.blucigs.com/');
    pagepeel.small_path = 'peel-small.swf';
    pagepeel.small_image = escape('peel-small.jpg');
    pagepeel.small_width = '100';
    pagepeel.small_height = '100';
    pagepeel.small_params = 'ico=' + pagepeel.small_image;
    pagepeel.big_path = 'peel-big.swf';
    pagepeel.big_image = escape('peel-big.jpg');
    pagepeel.big_width = '650';
    pagepeel.big_height = '650';
    pagepeel.big_params = 'big=' + pagepeel.big_image + '&ad_url=' + pagepeel.ad_url;
    
    
    function sizeup987(){
    	document.getElementById('jcornerBig').style.top = '0px';
    	document.getElementById('jcornerSmall').style.top = '-1000px';
    }
    
    function sizedown987(){
    	document.getElementById("jcornerSmall").style.top = "0px";
    	document.getElementById("jcornerBig").style.top = "-1000px";
    }
    
    function writeObjects () { 
        // Get installed flashversion
     var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
        // Check if flash exists / version matched
     if (hasReqestedVersion) { 
    
    pagepeel.putObjects = function () {
    
    // <jcornerSmall>
    document.write('<div id="jcornerSmall" style="position:absolute;width:'+ pagepeel.small_width +'px;height:'+ pagepeel.small_height +'px;z-index:9999;right:0px;top:0px;">');
    // object
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
    document.write(' id="jcornerSmallObject" width="'+pagepeel.small_width+'" height="'+pagepeel.small_height+'">');
    // object params
    document.write(' <param name="allowScriptAccess" value="always"/> ');
    document.write(' <param name="movie" value="'+ pagepeel.small_path +'?'+ pagepeel.small_params +'"/>');
    document.write(' <param name="wmode" value="transparent" />');
    document.write(' <param name="quality" value="high" /> ');
    document.write(' <param name="FlashVars" value="'+pagepeel.small_params+'"/>');
    // embed
    document.write('<embed src="'+ pagepeel.small_path + '?' + pagepeel.small_params +'" name="jcornerSmallObject" wmode="transparent" quality="high" width="'+ pagepeel.small_width +'" height="'+ pagepeel.small_height +'" flashvars="'+ pagepeel.small_params +'" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
    document.write('</object></div>');
    document.write('</script>');
    
    // <jcornerBig>
    document.write('<div id="jcornerBig" style="position:absolute;width:'+ pagepeel.big_width +'px;height:'+ pagepeel.big_height +'px;z-index:9999;right:0px;top:0px;">');
    // object
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
    document.write(' id="jcornerBigObject" width="'+ pagepeel.big_width +'" height="'+ pagepeel.big_height +'">');
    // object params
    document.write(' <param name="allowScriptAccess" value="always"/> ');
    document.write(' <param name="movie" value="'+ pagepeel.big_path +'?'+ pagepeel.big_params +'"/>');
    document.write(' <param name="wmode" value="transparent"/>');
    document.write(' <param name="quality" value="high" /> ');
    document.write(' <param name="FlashVars" value="'+ pagepeel.big_params +'"/>');
    // embed
    document.write('<embed src="'+ pagepeel.big_path + '?' + pagepeel.big_params +'" id="jcornerBigEmbed" name="jcornerBigObject" wmode="transparent" quality="high" width="'+ pagepeel.big_width +'" height="'+ pagepeel.big_height +'" flashvars="'+ pagepeel.big_params +'" swliveconnect="true" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
    document.write('</object></div>');
    
    
    setTimeout('document.getElementById("jcornerBig").style.top = "-1000px";',1000);
    }
    
    pagepeel.putObjects();
    
                                // Closing brace for hasReqestedVersion 
                                 } 
    
        else { 
          document.write('<div id="noflashtxt" style="font:bold 9px Arial; color:#FF4444; text-align:right; position:absolute; width:'+ pagepeel.small_width +'px; height:'+ pagepeel.small_height +'px; z-index:9999; right:0px; top:0px;">[no flash]</div>');
        } 
    
     // Closing brace for writeobjects 
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles