junior2e
asked on
onClick - change href
I have a dynamic list of thumbnails, and one cooresponding "medium" sized image that changes onClick... I also need to be able to allow the user to click on this medium sized image to view the "large" image.
My JS function is as -
function showMedium(imageName) {
document.bigImage.src = imageName;
}
This changes the medium size image, but I have a "a href" around the medium sized image that also needs to change.
<a href='???' target='new'><img name='bigImage' width='400' height='300' src='images/homes/medium/" & house_ID & ".jpg' border='0'></a>
Can I change the "href" value onClick - inside the above function?
Thanks!
My JS function is as -
function showMedium(imageName) {
document.bigImage.src = imageName;
}
This changes the medium size image, but I have a "a href" around the medium sized image that also needs to change.
<a href='???' target='new'><img name='bigImage' width='400' height='300' src='images/homes/medium/"
Can I change the "href" value onClick - inside the above function?
Thanks!
Dont forget changeHref() needs to be called from an event some where...
AArnie.
AArnie.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
AArnie's solution will only work in Internet Explorer 4.0+, since the "all" collection is a Microsoft proprietary extension to the "document" object. It is not recognized as a standard, and it will not work in any other browsers. The DOM is an open standard that all modern browsers must conform to.
gator4life
(chomp, chomp)
gator4life
(chomp, chomp)
ASKER
awesome, thanks for the help!
************************** ********** ********** *********
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
************************** ********** ********** *********
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:
- [Points to gator4life Grade A]
Please leave any comments here within the next seven days.
************************** ********** ********** *********
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
************************** ********** ********** *********
jAy
EE Cleanup Volunteer
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
**************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:
- [Points to gator4life Grade A]
Please leave any comments here within the next seven days.
**************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
**************************
jAy
EE Cleanup Volunteer
Just add an 'id' to the Href...
<A Href="link" id="Href1" Name="Href1">links</A>
then in code...
function changeHref(){
document.all("Href1").href
}
AArnie.