create a simple link

G

Glen Watkins

In HTML: <A HREF="webpage.htm"><IMG SRC="myimage.jpg"></A>

How would I write that in javascript....

..... and is there a site where I could've found that an answer, such a basic
tutorial site. I did look, I couldn't find this anywhere.

Thanks
 
D

David Mark

In HTML: <A HREF="webpage.htm"><IMG SRC="myimage.jpg"></A>

How would I write that in javascript....

.... and is there a site where I could've found that an answer, such a basic
tutorial site. I did look, I couldn't find this anywhere.

Thanks

document.write('<A HREF="webpage.htm"><IMG SRC="myimage.jpg"></A>
');
 
S

Stevo

David said:
document.write('<A HREF="webpage.htm"><IMG SRC="myimage.jpg"></A>
');

and to take that to a next stage, if you had your href URL and your
image URL in variables, you could do this:

document.write('<a href="'+myurl+'"><img src="'+myimg+'"><\/A>');
 
G

Glen Watkins

I don't have them in variables at this point, later I might be doing that. I
see you were forward thinking based upon my previous post.

Thanks for being knowledgeable, helpful, and efficient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top