First of all, let me explain the scenario. I'm trying to make an entry page that will use a javascript to display the user's screen resolution. If it is 1024 X 768 then I want nothing to happen. If the resolution is less than 1024 X 768 then I want it to create a link to open a new window with instructions on how to change the resolution. The catch is that I want to use the popular launchwin function to control the properties of the new window that the link will open. All of my pages include the launchwin function:
<SCRIPT LANGUAGE="JavaScript">
<!--
var newwin;
function launchwin(winurl,winname,winfeatures)
{
//This launches a new window and then
//focuses it if window.focus() is supported.
newwin = window.open(winurl,winname,winfeatures);
if(javascript_version> 1.0)
{
//delay a bit here because IE4 encounters errors
//when trying to focus a recently opened window
setTimeout('newwin.focus();',250);
}
}
//-->
</SCRIPT>
Here's what I have for detecting the viewer's screen resolution:
<script language="JavaScript">
if (screen.width < 1024)
document.write("Your monitor resolution is "+screen.width+" X "+screen.height+".<BR>Current technology insists that your monitor should be set at 1024 X 768")
else {// (screen.width > 1024)
document.write(".")
}
</script>
And here was my attempt at combining the two to create a link for a controllable pop-up window:
<script language="JavaScript">
if (screen.width < 2024)
document.write("Your monitor resolution is "+screen.width+" X "+screen.height+".<BR>Current technology insists that your monitor should be set at 1024 X 768<br><a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:launchwin('resolution.html' , 'resoolution' , 'height=410,width=700,toolbar=no,scrollbars=yes,status=no,location=no,menubar=no,directories=no')">Click here for directions</a>")
else {// (screen.width > 2024)
document.write(".")
}
</script>
And (obviously, since I'm here) that didn't work. I couldn't even get it to generate a simple html link, like this:
if (screen.width < 2024)
document.write("Your monitor resolution is "+screen.width+" X "+screen.height+".<BR>Current technology insists that your monitor should be set at 1024 X 768<br><a href=http://www.webdeveloper.com/forum/archive/index.php/"resolution.html">Click here for directions</a>")
else {// (screen.width > 2024)
document.write(".")
}
I'm definitely no expert with javascript; I'm really only capable of the basics, and using what I know to manipulate existing scripts (what a loser, right?). I would be very grateful to anyone that would be so kind as to delve into my problem and let me know what I'm doing wrong, and if what I'm trying to do is even possible. Thanks in advance.
<SCRIPT LANGUAGE="JavaScript">
<!--
var newwin;
function launchwin(winurl,winname,winfeatures)
{
//This launches a new window and then
//focuses it if window.focus() is supported.
newwin = window.open(winurl,winname,winfeatures);
if(javascript_version> 1.0)
{
//delay a bit here because IE4 encounters errors
//when trying to focus a recently opened window
setTimeout('newwin.focus();',250);
}
}
//-->
</SCRIPT>
Here's what I have for detecting the viewer's screen resolution:
<script language="JavaScript">
if (screen.width < 1024)
document.write("Your monitor resolution is "+screen.width+" X "+screen.height+".<BR>Current technology insists that your monitor should be set at 1024 X 768")
else {// (screen.width > 1024)
document.write(".")
}
</script>
And here was my attempt at combining the two to create a link for a controllable pop-up window:
<script language="JavaScript">
if (screen.width < 2024)
document.write("Your monitor resolution is "+screen.width+" X "+screen.height+".<BR>Current technology insists that your monitor should be set at 1024 X 768<br><a href=http://www.webdeveloper.com/forum/archive/index.php/"javascript:launchwin('resolution.html' , 'resoolution' , 'height=410,width=700,toolbar=no,scrollbars=yes,status=no,location=no,menubar=no,directories=no')">Click here for directions</a>")
else {// (screen.width > 2024)
document.write(".")
}
</script>
And (obviously, since I'm here) that didn't work. I couldn't even get it to generate a simple html link, like this:
if (screen.width < 2024)
document.write("Your monitor resolution is "+screen.width+" X "+screen.height+".<BR>Current technology insists that your monitor should be set at 1024 X 768<br><a href=http://www.webdeveloper.com/forum/archive/index.php/"resolution.html">Click here for directions</a>")
else {// (screen.width > 2024)
document.write(".")
}
I'm definitely no expert with javascript; I'm really only capable of the basics, and using what I know to manipulate existing scripts (what a loser, right?). I would be very grateful to anyone that would be so kind as to delve into my problem and let me know what I'm doing wrong, and if what I'm trying to do is even possible. Thanks in advance.