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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Rollover, Change HREF too 1

Status
Not open for further replies.

DeZiner

Programmer
May 17, 2001
815
US
Hi All,

I have five images in the right column of a page. Each image when rolled over changes a main image in the middle of the page. No problem here.

How can each new displayed image in the middle of the page have it's own HREF assisgned? The goal is thumbnail on right, midsize in middle, and click on middle midsize image for full size, or open new page.

Thanks!

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
<script>
function ChangeLink()
{
document.lnk1.href=&quot;asd1&quot;
}
</script>
<a href=&quot;asd&quot; name=&quot;lnk1&quot; onmouseover=&quot;ChangeLink()&quot;>Link</a>

Known is handfull, Unknown is worldfull
 
Simply returns an error of document.lnk1 is null or not an object.

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
You should be able to make use of something like this:
Code:
function ChangeLink( target_element, new_url ) {

	document.getElementById( target_element ).href = new_url;
}

Both my function and vbkris's assume that your image is contained within an anchor tag.

HTH.


 
Theboyhope, PERFECT. I worked off of that and got perfect results!

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Oops! What about netscape? Is it the getElementbyID that it doesn't like?

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Found my answer, had to add an ID name to the image.

That's what I get for askin before trying.
Thanks Again.

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Wait a moment! what about different urls for each of the 5 images? Isnt there some sort of variable that defines different pages or links etc?? If not where does one define the urls?

idaryl
idface.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top