Feeds:
Posts
Comments

Posts Tagged ‘Javascript’

fun with Javascript

I faced a problem to call 2 methods at the same time from body. and the solution is very simple. I wrote a script block at the end of the page look like that.

<SCRIPT LANGUAGE=”JAVASCRIPT”>

if(document.body.onload)

{

var existingOnLoad = document.body.onload;

document.body.onload = function()

{

existingOnLoad();

MyOwnMethod();

}

}

</SCRIPT>

Advertisements

Read Full Post »

here is the script not ot allow right click in browser

<script language=”Javascript1.2″>
am = “NO RIGHT CLICK ALLOWED!”;
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName==”Netscape”
bIE = navigator.appName==”Microsoft Internet Explorer”
function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
  alert(am)
     return false;
   }
}
document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;
</script>

Read Full Post »