View difference between Paste ID: mY9Eyt3k and e2vrLLNY
SHOW: | | - or go back to the newest paste.
1-
<html>
1+
function do_links(links) {
2-
  <head>
2+
3-
    <script type="text/javascript"><![CDATA[
3+
    link_prepare(links[i]);
4
  }
5-
  var links = $$('a');
5+
6
7-
    var link = $(links[i]);
7+
function link_prepare(link) {
8-
    link.observe('click', function (e) {
8+
  if (link.prepared) return;
9-
      console.log('Link', link); // si tu as toujours le même lien = problème de closure :P
9+
  
10-
      new Ajax.Updater('dMain', link.href); // si link merde, tente Event.findElement(e)
10+
  $(link).observe('click', function (e) {
11-
      e.stop(); // == return false sur le onclick();
11+
    var dasLink = Event.findElement(e);
12
    console.log('Link', link); // si tu as toujours le même lien = problème de closure :P
13
    new Ajax.Updater('dMain', link.href, {
14
      onComplete: function(response) {
15-
]]></script>
15+
        // Handle the response content...
16-
</head>
16+
        do_links($('dMain').select('a'));
17-
<body onload="my_onload();">
17+
      }
18-
  ...
18+
19-
</body>
19+
    e.stop(); // == return false sur le onclick();
20
  });
21
  
22
  link.prepared = true;
23
}
24
25
function my_onload() {
26
  do_links($$('a'));
27
}