It is Ok Robert.
Thanks
******************************
=A0=A0=A0=A0=A0=A0=A0=A0 Best Regards
=A0=A0=A0 =A0=A0=A0=A0=A0 Ali Benzes
IT Developer&Programmer
******************************
=A0
=A0
-----Original Message-----
From: Robert Nyman [mailto:robert.nyman@c...]
Sent: Monday, December 02, 2002 1:40 PM
To: JavaScript HowTo
Subject: [javascript_howto] SV: RE: SV: Document.body.background's
problem
Ah, I think I know why you got the error now.
You have two options, since the BODY element has to be created before
you access it.
Example 1:
<html>
<head>
<script language=3D"JavaScript" type=3D"text/javascript">
window.onload =3D function (){
if (screen.width=3D=3D800){
=09
document.body.background=3D"images/login800.gif";
}
else{
=09
document.body.background=3D"images/login1024.gif"
}=09
}
</script>
</head>
<body>
</body>
</html>
Example 2:
<html>
<head>
=09
</head>
<body>
<script language=3D"JavaScript" type=3D"text/javascript">
if (screen.width=3D=3D800){
document.body.background=3D"images/login800.gif";
}
else{
document.body.background=3D"images/login1024.gif"
}
</script>
</body>
</html>
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: Ali Benzes [mailto:alib@k...]
Skickat: den 2 december 2002 08:18
Till: JavaScript HowTo
=C4mne: [javascript_howto] RE: SV: Document.body.background's problem
Hi Robert.
Can I put this code between <body> </body>
else
<head> </head>
Because it's dont working same error;
I wrote that ;
<script>
if (screen.width=3D=3D800)
{
document.body.background=3D"images/login800.gif";
}
else
{
document.body.background=3D"images/login1024.gif"
}
</script>
******************************
=A0=A0=A0=A0=A0=A0=A0=A0 Best Regards
=A0=A0=A0 =A0=A0=A0=A0=A0 Ali Benzes
IT Developer&Programmer
******************************
=A0
=A0
-----Original Message-----
From: Robert Nyman [mailto:robert.nyman@c...]
Sent: Sunday, December 01, 2002 5:10 PM
To: JavaScript HowTo
Subject: [javascript_howto] SV: Document.body.background's problem
In the error message you're quoting, you have 'Document' with a capital
'D', but in the code you have lower-case 'd's...
Something's not right there.
Whatever the reason for that, the correct code is:
document.body.background =3D "image1.gif";
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: Ali Benzes [mailto:alib@k...]
Skickat: den 30 november 2002 19:57
Till: JavaScript HowTo
=C4mne: [javascript_howto] Document.body.background's problem
Hi All Friends.
I am receving this error,What's problem?;
'Document.body',null or not object
Here's the codes;
<script>
if (screen.width=3D=3D800)
{
document.body.background=3D'image1.gif'
}
else
{document.body.background=3D'image2.gif'}
</script>
******************************
Best Regards
Ali Benzes
IT Developer&Programmer
******************************