PDA

View Full Version : Onleave OF site Bookmark Ask??



gas0
October 7th, 2002, 02:09
?

Does anyone know how to get it so when a visitor leaves my site they are prompted with:

Would you like to Bookmark/Favorites this Site?

[ YES ] [ NO ]

if they say no they go to whatever they wanted to goto,
If yes they site is added to favorites... and then Next page is loaded....

Does anyone know how I would Do this?

THanks
Derek

biggulp
October 7th, 2002, 02:19
function bookIt(argVal)
{
var bookData = new Array();
bookData = argVal.split("|");
if (document.all)
window.external.AddFavorite(bookData[0], bookData[1]);
else
alert("Sorry. Netscape users must bookmark the pages manually by hitting <Ctrl-D>");
}

in your <body> tag
add onLoad="bookIt('http://www.google.com|Google');

gas0
October 7th, 2002, 02:45
WHat does that mean... Ive never worked with PHP....

I know html and perl.


I put that onload (smaller sript in html)


and do I make a PHP file for the big script part???


still confused...

THanks
D

Kaliber
October 7th, 2002, 04:20
lol, thats just javascript

biggulp
October 7th, 2002, 05:41
i used php tags for the hilighting

ansa
October 7th, 2002, 08:25
Originally posted by biggulp

in your <body> tag
add onLoad="bookIt('http://www.google.com|Google');

Think that should be onUnload shouldn't it?


Andy.

Kaliber
October 7th, 2002, 08:36
yes, it should

biggulp
October 7th, 2002, 09:42
sorry, typo. does it work now?;)

gas0
October 7th, 2002, 19:03
I have put:

onUnload="bookIt('http://www.google.com|Google');

in my body tag.

IT doesent work...

i go to the URL bar enter a new WWW ADDY / or favorites...

and There is no prompt.....

I think this can be acomplished with javascript....

Im looking for it... but so far I cant find it....

PLEASE Help ... U Script Guru's!:)

biggulp
October 8th, 2002, 00:31
try <body onLoad="bookIt('http://www.google.com|Google')"> left out the other quote

gas0
October 8th, 2002, 15:23
Yea.... when you put the onLoad:

you get an error in the corner of your browser and still doesent work.

When you put unLoad: No Error ... but still doesent work.


did you get it to work er what?
thanks
still hope'n
D

biggulp
October 9th, 2002, 01:37
<html><head><title>Bookmark</title></head>
<body onLoad="bookIt('http://www.google.com|Google')">Text here</body>
<script language="Javascript">
<!--
function bookIt(argVal)

{

var bookData = new Array();

bookData = argVal.split("|");

if (document.all)

window.external.AddFavorite(bookData[0], bookData[1]);

else

alert("Sorry. Netscape users must bookmark the pages manually by hitting <Ctrl-D>");

}
//-->
</script></html>

i got it to work.