Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Scrolling Issue

Thread Tools

Scrolling Issue

Posts: n/a

I am having an issue with a span I create dynamically with an image
inside that I use as a close button. The image has a css cursor
property set to pointer, and an onclick event associated with it. When
the the span is scrolled, I reset the position of my image to it is
always in the top right corner of the span.

When I scroll down the span element, my image loses its cursor
property and also its onclick event, unless I scroll back to the very
top in which case it works again. It is like the onclick event and the
cursor property do not scroll with the image.

If anyone has any suggestions, I would love to hear them. Thanks!

function CreateSpan() {
var sp = document.getElementById('spDetails');
if (!sp) {
sp = document.createElement('span');'absolute';'auto';'400px';'200px';'3px solid #000000';'green';'.95';'alpha(opacity=95)';'.95';'white';'spDetails';;//always want on top, pop-up box style.'visible';
sp.onscroll = function () {
var sp2, sp;
sp = document.getElementById('spDetails')
sp2 = sp.getElementsByTagName('img')[0];
if (sp2) { + 3).toString() + 'px';'3px';
} else {
alert('no img');
}//end function

var spInner = new String('');
spInner += '<img style="height:20px;width:
20px;cursorointer;position:absolute;top:3px;righ t:3px;border:1px
solid black;" onclick="HideSpan()" src="
poPics/close.gif" />';
spInner += '<table id="poDetTbl"
style="color:#FFFFFF;position:absolute;top:22px;wi dth:380px"> ';
spInner += ' <tr> ';
spInner += ' <td>Data Line 1: </td> ';
spInner += ' <td></td> ';
spInner += ' </tr> ';
spInner += ' <tr> ';
spInner += ' <td>Data Line 2: </td> ';
spInner += ' <td></td> ';
spInner += ' </tr>';
spInner += ' <tr>';
spInner += ' <td>Data Line 3: </td>';
spInner += ' <td></td> ';
spInner += ' </tr> ';
spInner += '</table>';

} else {'visible';
}//end if-else span already exists
}//end function CreateSpan
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
smooth scrolling & auto scrolling sillyputty Firefox 1 08-24-2007 02:10 AM
JTable scrolling issue Java 2 03-13-2007 02:09 AM
Annoying window scrolling issue with Thunderbird Z Firefox 2 06-13-2006 06:00 PM
scrolling issue. pleeeezzzz help... Mel Javascript 3 03-25-2005 05:13 PM
scrolling issue jenv Computer Support 3 01-25-2004 07:33 PM