Javascript Problem
Hey...I am having two JS issues...neither of them will run. I have tried everything...so could you help me out?
I have this file:
function small() {
window.location="http://www.intuitiontech.com/msc/smindex.html";
}
function norm() {
window.location="http://www.intuitiontech.com/msc/normindex.html";
}
if ((screen.width=640) && (screen.height=480)) {
setTimeOut('small()', 5000);
}
else {
if ((screen.width>=1024) && (screen.height>=768)) {
setTimeOut('norm()', 5000);
};
}
which is referenced to in the following manner (in ):<script type="text/javascript" src="http://www.intuitiontech.com/msc/resolution.js"></script>
It won't run. I tried sending alert boxes and everything...I tried without timelimits...nothing works.
It can be seen at http://www.intuitiontech.com/msc/index.html
Thanks.
TonyMontana posted this at 19:52 — 22nd February 2004.
They have: 218 posts
Joined: Apr 2001
>setTimeOut();
Have you tried setTimeout() ?
TM
kb posted this at 20:06 — 22nd February 2004.
He has: 1,380 posts
Joined: Feb 2002
I first tried this script without even using the timeout...just straight redirect
bja888 (not verified) posted this at 16:27 — 23rd February 2004.
They have: 5,633 posts
Joined: Jan 1970
I perfer open() over window.location but thats too simple to stress over it
TonyMontana posted this at 18:49 — 23rd February 2004.
They have: 218 posts
Joined: Apr 2001
A couple of things with your script...there are no settings for 800x600.
For clarity, you could probably reduce the code to one function:
function relocate()
{
var sW = screen.width;
var sH = screen.height;
if (sW > 800)
{
var loc ="http://www.intuitiontech.com/msc/normindex.html";
}
else
{
var loc ="http://www.intuitiontech.com/msc/smindex.html";
}
window.location = loc;
}
TM
kb posted this at 01:36 — 24th February 2004.
He has: 1,380 posts
Joined: Feb 2002
that's all well and good, but two things:
#1- I'm not done with the script...there will be multiple screen resolution possibilites
#2- DOES ANYBODY KNOW WHY THIS DOESN'T WORK?
Suzanne posted this at 04:36 — 24th February 2004.
She has: 5,507 posts
Joined: Feb 2000
I don't see why you're setting functions.
Put the script in the and put the window.location lines in the actual conditions and it works fine.
bja888 (not verified) posted this at 16:06 — 24th February 2004.
They have: 5,633 posts
Joined: Jan 1970
I dont see anything wrong with it. Your computer is prouably just [word deleted].
TonyMontana posted this at 19:45 — 24th February 2004.
They have: 218 posts
Joined: Apr 2001
>Have you tried setTimeout() ?
I tested your script and it works if you switch setTimeOut() to setTimeout().
TM
kb posted this at 23:23 — 24th February 2004.
He has: 1,380 posts
Joined: Feb 2002
I was setting functions to make it easier to follow...
Thanks.
Suzanne posted this at 00:26 — 25th February 2004.
She has: 5,507 posts
Joined: Feb 2000
In this case the screen resize width/height test IS the function. The whole thing is the function.
kb posted this at 00:30 — 25th February 2004.
He has: 1,380 posts
Joined: Feb 2002
Oh, ok.
Thanks.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.