Note that there are some explanatory texts on larger screens.

plurals
  1. POenable/disable onclick event with javascript with function variables
    primarykey
    data
    text
    <p>this is my first question to any of the forums, hope to get some useful and quick reply..</p> <p>here is my php code :</p> <pre><code>&lt;a href="&lt;?php echo $sp['url']; ?&gt;" id="bstd&lt;?php echo $sp['Id']; ?&gt;" target="_blank" onclick="clk('&lt;?php echo $sp['Id']; ?&gt;','&lt;?php echo $_REQUEST['uid']; ?&gt;')"&gt;&lt;img src="images/add.jpj"&gt;&lt;/a&gt; </code></pre> <p>and the following javascript function :</p> <pre><code>&lt;script&gt; function clk(a,b){ ......... the ajax code to use a,b as variables ........ } &lt;/script&gt; </code></pre> <p>every this is working fine ... but. in another javascript function... i want to enable/disable the onclick of the and href of </p> <pre><code>&lt;script&gt; function disb(p){ if(p&gt;5){ av=document.getElementById(bstd); //working fine av.setAttribute("href", "#"); //working fine av.style.cursor="default"; //working fine av.onclick = cancel; //not working... i want to disable the onclick. }else{ av=document.getElementById(bstd); //working fine av.setAttribute("href", ???); //i want the previous code url link automatically..as it was dynamic and coming from php. av.style.cursor="pointer"; //working fine av.onclick = ???; //i want the onclick function clk(with the dynamic php values). } } &lt;/script&gt; </code></pre> <p>i know its not easy to under stand.. what i want... so here is a breif discription...</p> <p>i have a image "a1" on click of this i count how many times i clicked this image... and now after this... if i clicked it more than 5 times... then only ... the onclick of tag shoud be enabled... otherwise on each click it should disable the onclick of tag (i have another image which counts downwards, so i need to disable it every time, weather it is enabled or disabled)</p> <p>i dont know it makes sense or not... but i want solution...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload