[Javascript] CSS in JS function - where is the error?

Ben Joyce ben at babelfish.co.uk
Tue Jan 28 12:10:41 CST 2003


missing ; at end of this line:

> var banerleft = odLewa - 500 +"px"

for starters.

hth,

 .b

> -----Original Message-----
> From: javascript-admin at LaTech.edu 
> [mailto:javascript-admin at LaTech.edu] On Behalf Of Andrzej Wroblewski
> Sent: 28 January 2003 17:43
> To: javascript at LaTech.edu
> Subject: [Javascript] CSS in JS function - where is the error?
> 
> 
> Hi,
> Look at this function and tell me what is wrong:
> 
> <HTML>
> <HEAD>
> <script TYPE="text/javascript">
> function pozBaner() {
> var odLewa=document.body.clientWidth;
> var banerleft = odLewa - 500 +"px"
> alert(banerleft);
> 
> //variable banerleft equals for example 511px so why baner.gif is 
> not moved 511px to the left??
> // when I type for example 511px instead of "+banerleft+" (in 
> line below) everythnig is ok
> 
> document.write('<div style="position:absolute; 
> left:"+banerleft+";">');
> document.write('<img SRC="baner.gif">'); 
> document.write('</DIV>'); } </SCRIPT> </HEAD> <BODY> <script 
> TYPE="text/javascript">
> 	 pozBaner();
> 	 </SCRIPT>
> </BODY>
> </HTML>
> 
> Where I made a mistake?
> Thanks for any help.
> 
> Greetings 
> andrzej w.
> ------------------------------------
> e-mail: alfwro at wp.pl
> http://republika.pl/wroblewski_online
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu 
> https://lists.LaTech.edu/mailman/listinfo/java> script
> 




More information about the Javascript mailing list