Email conversation
From | Mrinmoy Pal |
To | Me |
Subject | How to use javascript variable in html tag |
Date | 29 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
From | Me |
To | Mrinmoy Pal |
Subject | Re: How to use javascript variable in html tag |
Date | 29 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/