Mrinmoy Pal

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromMrinmoy Pal
ToMe
SubjectHow to use javascript variable in html tag
Date29 July 2005 14:34
Hello,
   Its, Mrinmoy, a web developer, designing a site for my office in
   javascript.
   The problem I am facing right now is that-----------
        I can not include javascript variable in HTML tag to .I want this
        variable to give the size of a image.I have used the following
<img src="pic.gif" width="&{onwidth};"  height="25" >
where onwidth is a javascript global variable  
But it did not work
 
how could I do it
FromMe
ToMrinmoy Pal
SubjectRe: How to use javascript variable in html tag
Date29 July 2005 14:43
Mrinmoy,

> <img src="pic.gif" width="&{onwidth};"  height="25" >

This is a non-standard extension supported only by Netscape 4 (without the
quotes). For other browsers, you will need to write the entire img tag
with script:

<script type="text/javascript"><!--
document.write(
  '<img src=\"pic.gif\" width=\"'+onwidth+'\" height=\"25\" alt=\"\">'
);
//--></script>


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.