You can simplify it somewhat by using a front-end function. So where we had:
Code:
<script type="text/javascript">
function pollContent(id){
if(document.getElementById(id))
initLightbox();
else
setTimeout("pollContent('"+id+"')", 1000)
}
</script>
Add below it like so:
Code:
<script type="text/javascript">
function pollContent(id){
if(document.getElementById(id))
initLightbox();
else
setTimeout("pollContent('"+id+"')", 1000)
}
function polJax(url, containerid, pollid){
if(!document.getElementById(pollid)){
ajaxpage(url, containerid);
pollContent(pollid);
}
}
</script>
Now your events can look like so:
HTML Code:
<a href="#" onclick="Effect.toggle('d2','BLIND'); return false;" onmouseup="polJax('ajaxfiles/external2.htm', 'test', 'poll1');">Toggle blind</a>
Added: Since you say that the 1 second delay seems too long, you can change the 1000 value to 60. 60 milliseconds is pretty quick but, as a poll, shouldn't give many, if any, computers problems like a 1 millisecond poll could.
Bookmarks