JavaScript: Load a script when specific <a> is active
<pre><code>&lt;script&gt;
function AdImageTag(){ 
var q1=document.getElementById( 'ctl00_ContentPlaceHolder1_ctl00_ctl00_Showcase' ).childNodes[1].innerHTML;
var counter1=0;


function iterate(q1,counter1){

q1= document.getElementById( 'ctl00_ContentPlaceHolder1_ctl00_ctl00_Showcase' ).childNodes[1].innerHTML;

 if(q1.match(/loader.gif/)){      
 counter1=counter1+1;
         setTimeout(function() {iterate(q1,counter1)},100); //100milli seconds

       }else{
function getrakhitagimage(){
    var refrencestring = document.getElementsByClassName('mtb-desc');
    var maindiv = document.getElementsByClassName('bucket');
    for(var i=12;i&lt;maindiv.length;i++){
        var current_bucket = maindiv[i];
alert(current_bucket.firstChild.firstChild.innerHTML);

    }
}

getrakhitagimage();

}
}
iterate(q1,counter1);
}
AdImageTag();
&lt;/script&gt;
</code></pre>

<p>when first time page load my script runs well but on the same page when some other link is clicked and it display content on the same page only but than my script is not running?
so how can i trigger that script when that link is clicked.</p>
