Hi
I am complete javascrpt newbie, I have this script. Not my work.
function fav() {
var newT = document.createTextNode('Add to Favourites');
var s = document.getElementById('fav');
if (window.sidebar) {
s.appendChild(newT);
s.style.cursor = 'pointer';
s.onclick = function() {window.sidebar.addPanel(document.title,self.location,'')};
} else if (window.external) {
s.appendChild(newT);
s.style.cursor = 'pointer';
s.onclick = function() {window.external.AddFavorite(self.location,document.title)};
} else if (window.opera) {
s.appendChild(newT);
s.style.cursor = 'pointer';
s.onclick = function() {
var e = document.createElement('a');
e.setAttribute('href',self.location);
e.setAttribute('title',document.title);
e.setAttribute('rel','sidebar');
e.click();
}
}
}
var pageLoaded = 0;
window.onload = function() {pageLoaded = 1;}
function loaded(i,f) {
if (document.getElementById && document.getElementById(i) != null) f();
else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
}
loaded('fav',fav);
The script adds a add to favourites link to a page.
This works without any problems.
My intention is to adapt the script so instead of outputting a link(text) it outputs a image.
But I don't how to do this.
Please help. Thanks