PDA

View Full Version : javascript bookmark



rich1234
02-01-2008, 11:22 AM
Hi, Could anyone tell me if I have altered this code correctly. It works fine, although when I download a toolbar for windows vista, it crashes when I click a bookmark link. Having stripped everything away, I concluded that it was to do with this bit of code.

I added asp to this


<a href="bookmark.php" onclick="addthis_url = location.href; addthis_title = document.title; return addthis_click(this); ">
to get this


<a href="bookmark.php" onclick="addthis_url = 'http://www.mysite.com/artgallery.asp?AuthorTwo=<%=rsCard("authorTwo")%>'; addthis_title = '<%=rsCard("author")%>'; return addthis_click(this);">
As I said it works but as I dont know javascript not sure if I have done it right.

Any pointer would be helpful.
Thanks
Richard

jscheuer1
02-01-2008, 02:17 PM
You can use the browser's 'view source' when visiting this page to see any differences between the served content and what you expect it to be.

Not having Vista I would have no way of testing but, if using:


<a href="bookmark.php" onclick="addthis_url = location.href; addthis_title = document.title; return addthis_click(this); ">

doesn't crash it, why not just arrange for the href and title of the page to be what your asp code would make them in the above onclick event, they should be anyway, because that's the page the bookmark will take the person to.

If you are using asp, why is the href PHP? If you are using javascript to set the bookmark, why doesn't the onclick event return false?