HighDots Forums  

making a back button

Javascript JavaScript language (comp.lang.javascript)


Discuss making a back button in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David
 
Posts: n/a

Default making a back button - 08-01-2003 , 02:15 AM






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>

Reply With Quote
  #2  
Old   
herders@yahoo.com
 
Posts: n/a

Default Re: making a back button - 08-02-2003 , 09:26 PM







<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>

David wrote:

Quote:
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


Reply With Quote
  #3  
Old   
David
 
Posts: n/a

Default Re: making a back button - 08-03-2003 , 03:12 AM



Thanks - sorted!

<herders (AT) yahoo (DOT) com> wrote

Quote:
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

David wrote:

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




Reply With Quote
  #4  
Old   
Evertjan.
 
Posts: n/a

Default Re: making a back button - 08-03-2003 , 04:18 AM



wrote on 03 aug 2003 in comp.lang.javascript:
Quote:
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();"


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.