PDA

View Full Version : Resolution detection Tweak



zutrix
01-16-2007, 07:53 AM
is it posible to have the show a message?

this is the original


<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>


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???

tech_support
01-16-2007, 08:08 AM
Warning: Please post all Dynamic Drive Script Related Questions here (http://www.dynamicdrive.com/forums/forumdisplay.php?f=2)

Sticky

Anyway,



<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>

trippin
01-16-2007, 08:10 AM
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>