Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to know if it is possible to

Status
Not open for further replies.

OSR

Programmer
Jul 23, 2001
110
US
I need to know if it is possible to place javascript variables into HTML tags as arguments for the tags properties.......Example

<IMG src=myJavascriptVar; >

I already know about DOM and controlling tag properties
through scripting but I'd like to just place the value of a javascript var in an HTML tag and be able to use it.

Also, I need to know what I need to do in order to get my pics on my site load line by line. I'm talking about the effect you see if you go to porn sites where large high quality pics load from the top down, you don't have to wait for the entire pic to load to be able to see it. I've read how to do this in some book but have forgotten what it said, is it some property I need to set in the IMG tag or is it a defualt property of newer browsers?
 
I think the line-by-line effect you're looking for is called a progressive jpeg, but I'm not certain of that.

I know there's supposed to be a way to insert the value of a javascript variable into html, but I haven't figured out how yet.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
you could try <img src=&quot;javascript:imgVar&quot;> i dont think that will workt though... -Greg :-Q
 
I remember seeing how to do something like this in a book and I don't think it was an ASP version of achieving this, <%=myVar%>. I believe you had to refer to the var in some way but I remember that it started with an ESCAPE sequence like '&', like   and other HTML escape sequences it began with the AND symbol and the rest I forget. Rocco is the BOY!!

M O T I V A T E!
 
do you relize that you can just use javascript to put the image there? -Greg :-Q
 
According to developer.netscape.com, you can use the value of a javascript variable where an attribute value would go like this (assuming a variable name barWidth):
Code:
<HR WIDTH=&quot;&{barWidth};%&quot; ALIGN=&quot;LEFT&quot;>
BUT, this apparently ONLY works for attribute values!
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top