making a back button

D

David

Hi,

I have a graphic with a rollover for site navigation on each page. I
put the page to go back to in the rollover javascript.

My question is, is it possible to put in some code that will refer the
visitor back to whatever page they came from rather than one I
specify?

The rollover is combined with a tooltip script to make matters fun
(below). However, I'm quite happy to lose the tooltip to have the link
perform as a back button.

Thanks

David

<a href="../index.asp"
onmouseover="document.images['link1'].src=img2.src;
showtip(this,event,'Back to home page');"
onmouseout="document.images['link1'].src=img1.src; hidetip()";><img
src="bhome.gif" name="link1" border=0></a>
 
H

herders

<a href="#" onclick="javscript:history.go(-1);"
onmouseover="document.images['link1'].src=img2.src;
showtip(this,event,'Back to home page');"
onmouseout="document.images['link1'].src=img1.src; hidetip()";><img
src="bhome.gif" name="link1" border="0" /></a>
 
D

David

Thanks - sorted!

<a href="#" onclick="javscript:history.go(-1);"
onmouseover="document.images['link1'].src=img2.src;
showtip(this,event,'Back to home page');"
onmouseout="document.images['link1'].src=img1.src; hidetip()";><img
src="bhome.gif" name="link1" border="0" /></a>
Hi,

I have a graphic with a rollover for site navigation on each page. I
put the page to go back to in the rollover javascript.

My question is, is it possible to put in some code that will refer the
visitor back to whatever page they came from rather than one I
specify?

The rollover is combined with a tooltip script to make matters fun
(below). However, I'm quite happy to lose the tooltip to have the link
perform as a back button.

Thanks

David

<a href="../index.asp"
onmouseover="document.images['link1'].src=img2.src;
showtip(this,event,'Back to home page');"
onmouseout="document.images['link1'].src=img1.src; hidetip()";><img
src="bhome.gif" name="link1" border=0></a>
 
E

Evertjan.

wrote on 03 aug 2003 in comp.lang.javascript:
<a href="../index.asp"
<a href="#" onclick="javscript:history.go(-1);"
onmouseover="document.images['link1'].src=img2.src;
showtip(this,event,'Back to home page');"
onmouseout="document.images['link1'].src=img1.src; hidetip()";><img
src="bhome.gif" name="link1" border="0" /></a>

why not:

<a href="../index.asp" onclick="history.go(-1);">
<img
src="bhome.gif" border="0"
onmouseover="this.src=img2.src;showtip(this,event,'Back to home page');"
onmouseout="this.src=img1.src; hidetip();"
/>
</a>

- The href is only used if javascript is not available
- mind the spelling of javascript
- javascript is default in onclick
- ";> is wrong, should be ;">
- if img1.src is 'bhome.gif' why not generalize to:

onmouseover="this.old=this.src;this.src=img2.src;
showtip(this,event,'Back to home page');"
onmouseout="this.src=this.old; hidetip();"
 

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
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top