Click to See Complete Forum and Search --> : Still needs Javascript!!


Lt. RaZieL
01-21-2003, 12:01 PM
Hi again folks!

I've asked for a certain javascript before and some nice people have tried to help me out. Still can't get it to work though. What I need is a script that determine the resolution of the users screen and then redirects them to one of two pages (one with the resolution 1024*768 and one with 800*600). But the redirection shall take place first after five seconds because I have a welcome site that I want the user to take a good look at first. Take a look for yourself at: www.stenmarks.se (http://www.stenmarks.se) (the page is in swedish but you'll probably understand what I want the script to do anyway) Please tell me where I shall insert the script because I don't know s**t about JS.

Thanks/Benny

(Excuse my poor English)

AdamBrill
01-21-2003, 12:42 PM
Try this:

<script language=javascript>
function go(where)
{
document.location=where;
}
if(screen.width>800)
{
setTimeout("go('1024/main.htm')",5000);
}
else
{
setTimeout("go('800/main.htm')",5000);
}
</script>

It should be the first thing in the body tag. Like:
<body>
<!--The script above-->
<!--The rest of your code-->
</body>
And I looked on your site so the links should even be right. Just put that in the top of the body and it should work fine. Let me know if you have any more problems...