pt83
06-04-2004, 01:41 PM
Is it possible to use a javascript variable within an html tag to set an attribute? Basically, I want to declare a constant that I can insert in multiple tags.
for example, instead of...
<iframe name='if1' frameborder='5' ...></iframe>
<iframe name='if2' frameborder='5' ...></iframe>
can I do somthing like this...
<script>var bdr='5';</script>
<iframe name='if1' frameborder=<script>document.write(bdr)</script> ...></iframe>
<iframe name='if2' frameborder=<script>document.write(bdr)</script> ...></iframe>
or, do I need to set the attribute separately outside the html tag (i.e., setAttribute)?
Thanks,
pt
for example, instead of...
<iframe name='if1' frameborder='5' ...></iframe>
<iframe name='if2' frameborder='5' ...></iframe>
can I do somthing like this...
<script>var bdr='5';</script>
<iframe name='if1' frameborder=<script>document.write(bdr)</script> ...></iframe>
<iframe name='if2' frameborder=<script>document.write(bdr)</script> ...></iframe>
or, do I need to set the attribute separately outside the html tag (i.e., setAttribute)?
Thanks,
pt