Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help to correct mistake

Status
Not open for further replies.

VJar

Programmer
Aug 3, 2002
18
UA
Why method 1 is right and workes,
but method 2 is not right?

Method 1:

<script language=&quot;JavaScript&quot;>
sw = screen.width;
sh = screen.height;
document.write(sw);
if (sw == 1024)
document.body.background = &quot;background.jpg&quot;
</script>

Method 2:

<script language=&quot;JavaScript&quot;>
sw = screen.width;
sh = screen.height;

if (sw == 1024)
document.body.background = &quot;background.jpg&quot;
</script>
 
They're the same except for the document.write part. They should both change the background fine only the second one won't write the width.

Rick It's a pleasure to know that I've helped you. If I have,
please click the link below to let me know. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top