No JavaScript is not compatible with all web browsers, because all web browsers do not support it.
Yes, that script is compatible with IE7.
Edit: I forgot the word "not".
Printable View
No JavaScript is not compatible with all web browsers, because all web browsers do not support it.
Yes, that script is compatible with IE7.
Edit: I forgot the word "not".
Problem solved.
Many thanks to Kravvitz and the others here, for all of the help given in this thread - it's been very much appreciated.
Dez.
Aaaaargh - spoke too soon ! How would you do it Kravvitz, using your method, if you wanted the user to click on an image to add to their favorites please ?
http://www.010805.com/favorites
Any help much appreciated.
Dez.
The script would need to be modified to create an image inside the link instead of text.
Why do you want to use a star? People who don't use IE/Win might not realize what it's for.
Many thanks for the quick response Kravvitz - it's appreciated.
There might be the text link on one page and the image link on another page, so the script would need to accommodate both really.
Good point about the star - sometimes people notice images more than text, and I think that the star is widely recognised by nearly all users as an add to favorites image.
All the best.
Dez.
Hi Kravvitz,
How did it go with the code for the image please ? Any luck with it ?
All the best.
Dez.
Having an image instead of text inside a link is relatively common.
Instead of <a ... >text here</a>
it's <a ... ><img ... /></a>
Are you having problems with your version of this mark-up?
You have there two id, both the same. Id must be unique, that is why the second one link not works as you expected.
Many thanks for the input Mittineague and Mirek, but I don't really know what to do next on this.
In answer to Mittineague, I think, from what Mirek's saying, is that there needs to be another way to identify that a link with the image in it ?
Kravvitz has kindly got me to this point, but just need to get the image part done now.
Any help appreciated.
Dez.
Sorry, I didn't check the page's source before. But Mirek is correct, you will have problems trying to use ids that aren't unique.
Does it produce suitable results if you tryHTML Code:<li id="addBookmarkContainer"></li>
<p> </p>
<li id="addBookmarkContainer"> <img border="0" src="index.1.jpg"></li>
instead?HTML Code:<li id="addBookmarkContainer"> <img border="0" src="index.1.jpg"></li>
You expect me to customize it for you for free? *sigh*
It's given me an idea for an improvement.
The link is generated with a JS/DOM script. :p
Yes, IDs must be unique. Also the script isn't magic. It must be written in such a way that it creates the image inside the link.
That's putting it lightly. You're using my script and I've had to coach you about how to use it.
I've updated the script now.
Just trying to implement what was kindly suggested here (been a bit of delay due to family problems - I guess we all get them!!).
When clicking on that link above, the bookmark link on that page still says press ctrl D to bookmark the page ? I thought we were trying to bookmark by clicking once on the link and then clicking ok, for it to go into your favourites and not into the sidebar ? and without any need for pressing ctr D In fact the same way that IE users do it ?
Any help much appreciated.
Dez.
Yes, we would like to avoid making the user press CTRL + D. However, the two ways to bring up the Add Bookmark dialog by clicking on a link in Firefox both add a bookmark that opens in the sidebar. You would have to go to the bookmark's properties after you added it to disable that so it would load in a normal window/tab. I expect most users would be unpleasantly surprised and probably confused when the bookmark opened in the sidebar instead of where it normally would.
Hi Kravvitz,
When you adjusted the code to make sure that it worked for images - is that the new code on your link please ?
I've tried to do it a little - but the bookmark on the image doesn't work ?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Bookmark</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="add_bookmark.js"></script>
<style type="text/css">
body {
background-color: #fff;
font-family: arial, helvetica, verdana, tahoma, sans-serif;
color: #000;
margin: 100pxx;
text-align: center;
padding: 100px;
}
a {
color: #000;
font-weight: normal;
}
a:hover {
background-color: #000;
color: #fff;
text-decoration: none;
}
</style>
</head>
<body>
<p id="addBookmarkContainer"><img border="0" src="index.1.jpg"></p>
</body>
</html>
http://www.010805.com/favorites
The helps appreciated.
Dez.
The script will generate the <img> when you call the function that creates an image link instead of the one that creates a text link. So remove the <img> from the HTML and in the script change
toCode:dss_addEvent(window,'load',addBookmarkObj.addTextLink);
// below is an example of how to make an image link with this
// the first parameter is the ID. If you pass an empty string it defaults to
// 'addBookmarkContainer'.
/*
dss_addEvent(window,'load',function(){
addBookmarkObj.addImageLink('','/images/add-bookmark.jpg');
});
*/
P.S. You should use CSS instead of the deprecated border attribute.Code://dss_addEvent(window,'load',addBookmarkObj.addTextLink);
// below is an example of how to make an image link with this
// the first parameter is the ID. If you pass an empty string it defaults to
// 'addBookmarkContainer'.
dss_addEvent(window,'load',function(){
addBookmarkObj.addImageLink('','index.1.jpg');
});
Hi Kravvitz,
Bet you thought you'd got rid of me eh :) Apologies for the time in between posts - family issues :(
I've now done what you kindly suggested above and the text link works great, but is there any way of getting it to do exactly the same thing on the image as well please ?
http://www.010805.com/bookmarks
As usual, the helps always appreciated.
Dez.
I'm not entirely sure what you're asking.
Try this.
Code:dss_addEvent(window,'load',function(){
addBookmarkObj.addImageLink('','index.1.jpg');
});
dss_addEvent(window,'load',addBookmarkObj.addTextLink);