call function each time the variable changes

Fighter-XP

New Member
\[code\]<script>function myFunction(a){ document.getElementById("demo").innerHTML=a;}</script>\[/code\]code to change variable on click\[code\]<?php$as=array(0,1,2,3,4,5); $a=sizeof($as);echo'<div class="navbox"><ul class="nav">';for($i=1;$i<$a;$i++){ echo '<li><a href="http://stackoverflow.com/questions/14079001/#" onclick="myFunction('.$as[$i].')">'.$as[$i].'</li>';}$u='<p id="demo"></p>';echo $u;ifrm();function ifrm(){ global $u; if($u=''){ echo 'empty'; } else{ $y='index.php?x='.$u; echo '<iframe src='http://stackoverflow.com/questions/14079001/.$y.'></frame>'; }}?>\[/code\]call the \[code\]function ifrm();\[/code\] each time the variable $u changes but it calls only ones what should it gets called
 
Back
Top