This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to Disable Right Click in browser window using javascript


On Sat, Mar 16, 2002 at 06:14:38PM +0200, Anupam Agarwal wrote:

> i want to disable right click of mouse in browsser window 
> how can this be done 

As your subject line says, it can be done using Javascript. Since this is
not a Javascript list, you will probably get better and faster answers by
checking one of the many Javascript web sites or mailing lists, or the
comp.lang.javascript news group. Once you know what Javascript you need,
it's usually a simple matter to create an XSLT stylesheet that will 
generate that script. E.g.:

  <xsl:template match="/">
    <html>
      <head>
        <title>No Right Clicks Allowed</title>
        <script type="text/javascript" language="JavaScript">
          &lt;!--
            function NoRightClicking(){
              ...
            }
          // --&gt;
	</script>
      </head>
      <body onLoad="NoRightClicking();">
        ...
      </body>
    </html>
  </xsl:template>

Notice that if you follow the conventional practice of wrapping the
JavaScript in a comment, you have to escape the opening '<' character.
Otherwise the XSLT processor will ignore the commented-out text instead
of writing it to the output. You could also use an <xsl:comment>
</xsl:comment> element.

Hope this helps.
-- 
Matt Gushee
Englewood, Colorado, USA
mgushee@havenrock.com
http://www.havenrock.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]