Showing posts with label Language Basics. Show all posts
Showing posts with label Language Basics. Show all posts

Wednesday, October 1, 2008

'onContextMenu' Example

 

    


<html>

<head>

<script language="JavaScript">

    
function function2() {

        
alert("This image is copyrighted") 

    
}

</script>

</head>

<body oncontextmenu="function2()">

    
<p>Right click in the image.</p>

    
<img oncontextmenu="function2()" 

         
src="http://www.navioo.com/style/logo.png" 

         
alt="www.navioo.com" 

         
width="99" 

         
height="76">

</body>

</html>

If you want to disable the context menu, 

add the following code to the <body>:

oncontextmenu="function2(); return false;"

      


      



Try it online

Sunday, September 14, 2008

Hide scripts using comments

<html>

<head>

<title>Hide scripts using comments.</title>

<script language="javascript" type="text/javascript">


<!--


lines of JavaScript code here

...


//-->


</script>


</head>

<body>


Page content here...


</body>

</html>





Try it