Re: small script question. need proper syntax

From: odyssey (paul.dallaire_at_sympatico.ca)
Date: 08/04/04


Date: Tue, 3 Aug 2004 20:51:59 -0400

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/background
_files/background_blue_1.jpg";
}
if (Wvalue==640&&Hvalue==480) {
image="../../../../../../../../../../../../../secondchance/images/background
_files/background_blue_2.jpg";
}
if (Wvalue==1024&&Hvalue==768) {
image="../../../../../../../../../../../../../secondchance/images/background
_files/background_blue_2.jpg";
}
if (Wvalue==1080&&Hvalue==1024) {
image="../../../../../../../../../../../../../secondchance/images/background
_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/backgr
> > > > ound_blue_640x480.jpg";
> > > >
> > > > else
> > > >
> >
image="../../../../../../../../../../../../../images/background_files/backgr
> > > > ound_blue_640x480.jpg";
> > > >
> > > > Thanks :)
> > > >
> > > > odyssey
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Page Structure
    ... The page contains a header and left column that remain constant. ... I load a variable according to which the contents of is called. ... Load b.php (left column info) ... (if $var is "elephants" include elephanttext.php) ...
    (comp.lang.php)
  • Page Structure
    ... Load a.php ... Load b.php (left column info) ... (if $var is "elephants" include elephanttext.php) ... (if $var is "tigers" include liontext.php) ...
    (comp.lang.php)
  • Re: best way to inherit funcs from another object
    ... for (var p in obj) { ... you load the script (presumably replacing what ... for methods, or do something similar for data properties, or both. ...
    (comp.lang.javascript)
  • Re: ghost load
    ... > load in parallel with them. ... > another fixture for this purpose without the light from it being seen. ... > purpose that was a proper resistive load, but *not* a source of light. ... sheets of primary red and one sheet of congo blue - classic "block ...
    (rec.arts.theatre.stagecraft)
  • Re: Override static derived variable
    ... > I'll add a bit to Jon's reply since I know you have a Delphi background. ... > .NET does NOT load a class until it is ACTUALLY used. ... private static string var; ... public static string GetVar() ...
    (microsoft.public.dotnet.languages.csharp)