Results 1 to 3 of 3

Thread: Resolution detection Tweak

  1. #1
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Resolution detection Tweak

    is it posible to have the show a message?

    this is the original

    Code:
    <script language="JavaScript1.2">
    <!--
    
    /*
    Screen resolution detection and notification Script- 
     Dynamic Drive (www.dynamicdrive.com)
    For full source code, installation instructions,
    100's more DHTML scripts, and Terms Of
    Use, visit dynamicdrive.com
    */
    
    var correctwidth=800
    var correctheight=600
    if (screen.width!=correctwidth||screen.height!=correctheight)
    document.write("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+". Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change the resolution!")
    //-->
    </script>
    Code:
    the one i just edit
    
    <script language="JavaScript1.2">
    <!--
    
    /*
    Screen resolution detection and notification Script- 
     Dynamic Drive (www.dynamicdrive.com)
    For full source code, installation instructions,
    100's more DHTML scripts, and Terms Of
    Use, visit dynamicdrive.com
    */
    
    var correctwidth=800
    var correctheight=600
    if (screen.width!=correctwidth||screen.height!=correctheight)
    function drawAlert () {
    alert ("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+". Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change the resolution!");
    //-->
    </script>
    can it work like this???

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Warning: Please post all Dynamic Drive Script Related Questions here


    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.

    Anyway,

    Code:
    <script language="JavaScript1.2">
    <!--
    
    /*
    Screen resolution detection and notification Script- 
    &#169; Dynamic Drive (www.dynamicdrive.com)
    For full source code, installation instructions,
    100's more DHTML scripts, and Terms Of
    Use, visit dynamicdrive.com
    */
    
    var correctwidth=800
    var correctheight=600
    if (screen.width!=correctwidth||screen.height!=correctheight)
    alert("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+". Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change the resolution!")
    //-->
    </script>
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Jan 2007
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This will work but you must use \n for linebreaks in an alert box. also take it out of the function.

    <script language="JavaScript1.2">
    var correctwidth=800
    var correctheight=600
    if (screen.width!=correctwidth||screen.height!=correctheight)
    alert ("This webpage is bested viewed with screen resolution
    "+correctwidth+"*"+correctheight+".\n Your current resolution is
    "+screen.width+"*"+screen.height+".\n If possible, please change the resolution!");
    //-->
    </script>

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
  •