My code is to preview webpages when user move mouse over <a></a>.  At
the same time, my code has other parts using Prototype
The following code can work well independently:

// javascript preview program start
var ci;
var xPos,yPos;
        var elms = document.getElementsByClassName("toplink");

 function gotopreview(event,ci){
        xPos = Event.pointerX(event);
        yPos = Event.pointerY(event);
        var getpostid=document.getElementsByName("targetpid");
        var getsid = document.getElementsByName("stdid");
        var url = "getOnePost.php";
        var pars = "stdid="+getsid[ci].value + "&targetpid=" + getpostid

        var myajax = new Ajax.Request(url,{
            parameters: pars,
                asynchronous: true,
                onSuccess: function(transport){
                        $('previewWin') = parseInt(yPos) + 2 + "px";
                        $('previewWin').style.left = parseInt(xPos) + 2 + "px";
                        $('previewWin').style.visibility = "visible";
                        $('previewWin').onmouseout =function(){ $
('previewWin').style.visibility = "hidden";}

// javascript preview program end
// The above code can work well independently.

And my html page is link:
<a class="toplink" value="XXX">XXX</a>
<a class="toplink" value="XXX">XXX</a>
<a class="toplink" value="XXX">XXX</a>
<a class="toplink" value="XXX">XXX</a>
<div id="previewWin"></div>

But when it comes to work with the periodical updater, it seems that
periodicalupdater send request first, breaking down the preview code
setting new Ajax.Request.  And the object is no longer refering to the
gotopreview function.

The following is my periodical code,

obj = new Object();
obj.f1 = eventHandler;
window.onload = obj.f1;
window.onunload = function(){};

function eventHandler(){

function postUpdater() {
        var myAjax = new Ajax.PeriodicalUpdater(
                        method: 'get',
                        frequency: 50

I use firebug to check the program and found that before I move mouse
over the "toplink" anchor, the postUpdater() function will send
request to the Sever thus, my preview code is no longer work.  I know
that there is bind and bindAsListener function to bind the gotopreview
function.  I tried but it's not work also, could some one help me or
tell me how to modify the code to make it work?  Is there any way stop
the periodicalUpdater when it is loaded?  Or if I must to use bind or
bindAsListener, how to write it correctly in the above code?  Any help
would be appreciated!
You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to