Re: small script question. need proper syntax

From: Jens Peter Karlsen[FP-MVP] (jpkarlsen_at_mvps.org)
Date: 08/04/04


Date: Wed, 4 Aug 2004 04:57:19 +0200

No need for an else. Instead of declaring image as an empty string,
declare it with the default image. If one of the if sentences evaluates
to true, the value will be overwritten.

Lastly I must again stress that the resolution is the wrong thing to
test for, instead you should test for the size of the browser window.
They will rarely be the same.

And out of curiosity, why do you write an empty center tag to the body?

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

-----Original Message-----
From: odyssey [mailto:paul.dallaire@sympatico.ca]
Posted At: 04. august 2004 02:52
Posted To: microsoft.public.frontpage.client
Conversation: small script question. need proper syntax
Subject: Re: small script question. need proper syntax

HI! ok, I see that I am not explaining what I want properly. so I will
give the whole piece and what it does. ( all I want is the proper way to
sent it to a default image)

Now. the code below checks if the users resolution matches any of the
below values and if so it loads the given image. now what if the user
has a rez that is not listed below? at this point as the code is it
would not load any image at all right?

So I need to add else statement so if the user does not have any of the
sez below it would at least load one image that I define as a default
image.

How do I add the ELSE statement?

Below is the in a js file.
-----------------------------------------Start of code-----------------
var Wvalue=(0) var Hvalue=(0) Wvalue=screen.width Hvalue=screen.height
var image=""; if (Wvalue==800&&Hvalue==600) {
image="../../../../../../../../../../../../../secondchance/images/backgr
ound
_files/background_blue_1.jpg";
}
if (Wvalue==640&&Hvalue==480) {
image="../../../../../../../../../../../../../secondchance/images/backgr
ound
_files/background_blue_2.jpg";
}
if (Wvalue==1024&&Hvalue==768) {
image="../../../../../../../../../../../../../secondchance/images/backgr
ound
_files/background_blue_2.jpg";
}
if (Wvalue==1080&&Hvalue==1024) {
image="../../../../../../../../../../../../../secondchance/images/backgr
ound
_files/background_blue_4.jpg";
}

document.open();
document.write("<BODY BACKGROUND='"+image+"'>");
document.write("<CENTER><\/CENTER>");

----------------------------------------------------------End of
code--------------------

Thanks for the responses guy and your patience :)

odyssey

"Andrew Murray" <SPAMadBUSTERmurray@iinet.net.au> wrote in message
news:410ecd2e$0$16329$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> ok...so the else clause should surely point to an image like
800_600image.jpg not
> 640_480image.jpg?
> as has been pointed out, they are pointing to the same image so
> whatever resolution the user has, the 640_480image.jpg is going to
load.
>
> "odyssey" <paul.dallaire@sympatico.ca> wrote in message
> news:B2tPc.7625$Jq2.387591@news20.bellglobal.com...
> > No. that's not what I meant. there are actually several IF
> > statements
and I
> > want a default one. if the nothing matches the what is in the if
statements
> > I want it to default to 800x600 screen rez.
> >
> > odyssey
> >
> > "MD Websunlimited" <none@none.com> wrote in message
> > news:OOdQ4ZIeEHA.328@TK2MSFTNGP12.phx.gbl...
> > > Nothing changes because both are pointing to the same image.
> > >
> > >
> > > --
> > > Mike -- FrontPage MVP '97-'02
> > > http://www.websunlimited.com
> > > FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
> > >
> > > "odyssey" <paul.dallaire@sympatico.ca> wrote in message
> > news:YvlPc.4777$Jq2.303644@news20.bellglobal.com...
> > > > HI! below is a part of a script that I need to add an else
> > > > statement
so
> > that
> > > > if a different rez is detected that does not match any of the IF
> > statement
> > > > that it will default to the one that I specify.
> > > > I tried just putting an else statement with the line I want but
> > > > it
does
> > not
> > > > work can someone correct me?
> > > >
> > > >
> > > >
> > > > if (Wvalue==640&&Hvalue==480) {
> > > >
> >
image="../../../../../../../../../../../../../images/background_files/ba
ckgr
> > > > ound_blue_640x480.jpg";
> > > >
> > > > else
> > > >
> >
image="../../../../../../../../../../../../../images/background_files/ba
ckgr
> > > > ound_blue_640x480.jpg";
> > > >
> > > > Thanks :)
> > > >
> > > > odyssey
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: small script question. need proper syntax
    ... Your empty center tag will not center the background image. ... need proper syntax ... > would not load any image at all right? ...
    (microsoft.public.frontpage.client)
  • Re: small script question. need proper syntax
    ... > Your empty center tag will not center the background image. ... > I don't want to check for the browser window for the above reason as I ... >> would not load any image at all right? ...
    (microsoft.public.frontpage.client)
  • Re: small script question. need proper syntax
    ... I don't want to check for the browser window for the above reason as I only ... > has a rez that is not listed below? ... > sez below it would at least load one image that I define as a default ...
    (microsoft.public.frontpage.client)
  • Re: Problem using parameters in query
    ... > on page load: ... > dim dealParam as new sqlParameter("@DealDate", dtmDate) ... I believe the proper syntax is: ...
    (microsoft.public.dotnet.framework.aspnet)

Loading