I'd like to make the link disable after user click the link! now i've the code for it, but it's not working if i use $PHP_SELF! here is the href code: any idea..? Please...help me...!!!
Try with this: <html> <head> <script type = "text/javascript"> function f_click( t ) { at = t.getAttributeNode("href"); window.open( at.value ); t.removeAttributeNode( at ); } </script> </head> <body> <a href="http://www.google.com" onclick="f_click(this);">Go to Google</a> </body> </html> Code (markup):
koemans: I see that you are using: class="link01" within the link, but it doesn't look like it's needed because you are using an image for the link. So, change the class to the PHP_SELF string, as shown: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Any Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function noLink(nLink){ var nHREF = nLink.className; if (nHREF != "") { nLink.className = ""; //window.open(nHREF); // or //self.location.href = nHREF; } } </script> <style type="text/css"> body {background-color:#eae3c6;margin-top:60px} </style> </head> <body> <a href="#" class="<?echo $PHP_SELF?>?kode_trans_far=<? echo $no_transaksi?>&kode_layanan=<? echo $kode_layanan?>&batal_transaksi=batal_transaksi" onclick="noLink(this);return false"><img src="/images/icon_hapus.gif" alt="Batal Transaksi" border="0"></a> </body> </html> Code (markup):