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

Enlarge Image onClick not working? 1

Status
Not open for further replies.

mrsjackaroo

Technical User
Sep 3, 2007
11
Hello again!

I've just found a script online which is exactly what I'm after - only trouble is, when I incorporate it into my html document it doesnt work?

<script type='text/javascript'>

function enlargeImage1(){
image1.height="334"
}
function dropImage1(){
image1.height="167"
}
function enlargeImage2(){
image2.height="98"
}
function dropImage2(){
image2.height="196"

</script>

<p><img src="images\esp avenue.jpg" height="167" name="image1" ondblclick="enlargeImage1()" onclick="dropImage1()"></p>

<p><img src="images\Esplanade house.jpg" height="98" name="image2" ondblclick="enlargeImage2()" onclick="dropImage2()"></p>

Any help, as always, is very much appreciated!

Rach
 
With the functions scripted like that, you've to worry always name collision. With the below, you don't have to worry about it any more.
[tt]
<script type='text/javascript'>

function enlargeImage1([blue]obj[/blue]){
[blue]obj[/blue].height="334"
}
function dropImage1([blue]obj[/blue]){
[blue]obj[/blue].height="167"
}
function enlargeImage2([blue]obj[/blue]){
[blue]obj[/blue].height="98"
}
function dropImage2([blue]obj[/blue]){
[blue]obj[/blue].height="196"
}
</script>

<p><img src="images\esp avenue.jpg" height="167" name="image1" ondblclick="enlargeImage1([blue]this[/blue])" onclick="dropImage1([blue]this[/blue])"></p>

<p><img src="images\Esplanade house.jpg" height="98" name="image2" ondblclick="enlargeImage2([blue]this[/blue])" onclick="dropImage2([blue]this[/blue])"></p>
[/tt]
 
You're a gem!

Thanks ever so much - its working perfectly now!

Take care

Rach
 
Hi

Rach, you received the needed help together with useful advice.

Now please express your gratitude in the Tek-Tips way too : click the

* [navy]Thank tsuji
for this valuable post![/navy]


link at the bottom of tsuji's post then click again to confirm on the page which will appear in a pop-up window.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top