The page shows the actual .href (you can not click on it though), but the onMouseOver and onMouseOut attributes are lost, and no new picture will appear (offsetted by X-Y coordonates)
It's somewhat confusing to describe this - but I figure that I made things at least a little clear. Does anybody have any idea how to fix this, and to make it work?
I want to make that element so I can modify the below code
t[t.length] = ["a_name","<a onmouseover='showImg(this,'http://picture.jpg')' onmouseout='hideImg()'><img src='http://thingy.gif' alt=''></a>"]
to
t[t.length] = ["a_name",n]
But neither having the above code in that huge t[t.lenth] form won't make it work,
1-st it gives a syntax error - i figure its because of the onmouseout attribute that has to declare itself using single quotes and to declare the img src with single quotes, so using in two instances single quotes,
2nd - it can not find the showImg function if I onMouseOver the pic
var b = document.createElement('br');
var n = document.createElement('a');
var i = document.createElement('img');
i.src = "http://thingy.gif";
i.alt = "";
n.appendChild(i);
n.href = "http://127.0.0.1";
n.setAttribute("onmouseover", "showImg(this,'picture.jpg')");
n.setAttribute("onmouseout", "hideImg()");
t[t.length] = n;
Unfortunately, it still doesn't work, which is pretty odd...
The new script gives no error whatsoever, the body appends the 'n' variable (which is an image, and the a href goes where it should), but somehow the onMouseOver and onMouseOut things get lost..
I read somewhere that if you create a new element, give attributes to it and then append it to the document, the attributes won't be initiated. (which is pretty much my problem here.)
I also read there that if you want to have those attributes to the element that you appended to the document, all you had to do is to re-initialize it, or something, as I unfortunately forgot the page talking about it, and I briefly remember the discussion.
Anyone know how I can re-initialize that n variable?
something like n = new n, if it exist..
Bookmarks