48 users online (1 members and 47 guests)  


  Results 1 to 8 of 8

Related

  1. Click- and rollover example    Forum: Javascript Forum
    Replies: 4
  2. no right click    Forum: HTML Forum
    Replies: 2
  3. How do I disable right-click?    Forum: Website Scripts Forum
    Replies: 9
  4. No right click    Forum: HTML Forum
    Replies: 3
  5. no right click    Forum: HTML Forum
    Replies: 7
  1. #1
    amit_vadnagr's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Feb 2002
    Posts
    26

    Question No right click!!!!!!!!!

    Dear sir,

    I tried this "no right click" script on my page, which was in a previous thread.

    "Keep in mind, that this script does not stop the user from saving images. Heck, once they view the page then the page and all of its content is already on the users harddrive. The user can also just use the top browser menu to do anything that is disabled with the no right click.

    With that said here is the code as written by
    Martin Webb
    -----place this in the <head> of your file-----
    <SCRIPT LANGUAGE="JavaScript1.1">
    -->
    <!-- Begin
    function right(e) {
    if (navigator.appName == 'Netscape' &&
    (e.which == 3 | | e.which == 2))
    return false;
    else if (navigator.appName == 'Microsoft Internet Explorer' &&
    (event.button == 2 | | event.button == 3)) {
    alert("Sorry, you do not have permission to right click.");
    return false;
    }
    return true;
    }

    document.onmousedown=right;
    document.onmouseup=right;
    if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    if (document.layers) window.captureEvents(Event.MOUSEUP);
    window.onmousedown=right;
    window.onmouseup=right;
    // End -->
    </script>
    ---------- "

    But it didnt work. The page URL is this:
    http://www.geocities.com/amit_vadnagra/aboutme/aboutme.html
    I have kept it as it is..u can view the page and also can view the source..
    the browser i used is MSIE 5.5, platform-98, platform version- win 9* 4.90.
    What went wrong???

    Regards,

  2. #2
    Enigma's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Nov 2000
    Posts
    426
    Try taking the ; off of the 14th line

    Code:
    -->;
    However, as was stated before, no right click scripts are annoying and they don't protect either your HTML pages or your images.

  3. #3
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    this ones much better...it gets rid of the annoying part and it adds another menu to your page!

    put this in your head:

    var menuskin=0;
    var display_url=1;
    function showmenuie5(){var rightedge=document.body.clientWidth-event.clientX;var bottomedge=document.body.clientHeight-event.clientY;if (rightedge<ie5menu.offsetWidth)ie5menu.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth
    else
    ie5menu.style.left=document.body.scrollLeft+event.clientX;
    if (bottomedge<ie5menu.offsetHeight)ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight;
    else
    ie5menu.style.top=document.body.scrollTop+event.clientY;ie5menu.style.zIndex="4";ie5menu.style.visibility="visible";return false}
    function hidemenuie5(){ie5menu.style.visibility="hidden"}
    function highlightie5(){if (event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="#7294AF";event.srcElement.style.color="black";
    if (display_url==1)window.status=event.srcElement.url}}
    function lowlightie5(){if (event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="#EAF0F7";event.srcElement.style.color="black";window.status=''}}
    function jumptoie5(){if (event.srcElement.className=="menuitems"){if (event.srcElement.getAttribute("target")!=null)window.open(event.srcElement.url,event.srcElement.getAttribute("target"))
    else
    window.location=event.srcElement.url}}

    put this in your body:

    <!--[if IE]>
    <div id="ie5menu" class="skin0" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5()">
    <div class="menuitems" url="">
    <u><b>Welcome</b></u></div>
    <div class="menuitems" url="blah.com">blahdy</div>
    <div class="menuitems" url="">
    <u><b>blahdy</b></u></div>
    <div class="menuitems" url="blah.php">blahdy</div>
    <div class="menuitems" url="blah.php">blahdy</div>
    <div class="menuitems" url="blah.php">blah</div>
    <![endif]-->
    if (document.all&&window.print){
    if (menuskin==0)
    ie5menu.className="skin0"
    else
    ie5menu.className="skin1"
    document.oncontextmenu=showmenuie5
    document.body.onclick=hidemenuie5
    }

    this creates yoru own right click menu with your own customized links

  4. #4
    Unregistered
    Unregistered's Avatar
    Guest

    Question

    what went wrong with this following code?





    <font face="arial, helvetica" size"-2"><br>
    <a href="http://www.angelfire.com/wrestling3/cawsite/index.html"></a></font>
    </center><p>

    <!-- Script Size: 1.35 KB --><p>

    <script language="JavaScript">
    <!--
    /*
    No rightclick script v.2.5
    (c) 1998 barts1000
    barts1000@aol.com
    Don't delete this header!
    */

    var message=Rabbits eat lettace!";

    // Don't edit below!

    function click(e) {
    if (document.all) {
    if (event.button == 2) {
    alert(message);
    return false;
    }
    }
    if (document.layers) {
    if (e.which == 3) {
    alert(message);
    return false;
    }
    }
    }
    if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    }
    document.onmousedown=click;
    // -->

    </script>

  5. #5
    amit_vadnagr's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Feb 2002
    Posts
    26

    No Right Click!!!!!

    OOPS.......
    neither of three options above worked...

    Regards,

  6. #6
    creature's Avatar
    New User

    Status
    Offline
    Join Date
    May 2002
    Posts
    22

    Lightbulb

    ok, to start this off theirs no point in no right clicks you can allways get what you want if you want it bad enough.

    Note: if you turn of your java scrpit then it will work.
    Note: if you view it in a new browser it will work.

    Atleast for java scrpit that i know of



    now don't get me wrong but thats a really long code.
    and me being new at this i'm looking for something shorter something kinda like this.

    place between <head> scrpit </head>


    <script language="Javascript1.2">

    message = "Function Disabled!";

    function NoRightClick(b) {
    if(((navigator.appName=="Microsoft Internet Explorer")&&(event.button > 1))
    ||((navigator.appName=="Netscape")&&(b.which > 1))){
    alert(message);
    return false;
    }
    }
    document.onmousedown = NoRightClick;

    // -->
    </script>




  7. #7
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    as I said before no right clicks are VERY annoying so here's the full code (the part that I missed is included ) to your own customized right click menu:

    Code:
    <html>
    <head>
    <style>
    <!--
    /*
    Context menu Script- 
     Dynamic Drive (www.dynamicdrive.com) Last updated: 00/03/28
    For full source code, 100's more DHTML scripts, and Terms Of Use, 
    visit dynamicdrive.com
    */
    
    .skin0{
    position:absolute;
    width:175px;
    border:2px solid black;
    background-color:#F5F5F5;
    font-family:Verdana;
    line-height:20px;
    cursor:hand;
    visibility:hidden;
    }
    
    .skin1{
    cursor: hand;
    font: menutext;
    position: absolute;
    width: 165px;
    background-color: menu;
    border: 1 solid buttonface;
    visibility:hidden;
    border: 2 outset buttonhighlight;
    }
    
    .menuitems{
    padding-left:15px;
    padding-right:10px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: black;
    }
    -->
    </style>
    
    <script language="JavaScript1.2">
    //set the skin of the menu (0 or 1, with 1 rendering a default Windows menu like skin)
    var menuskin=0
    
    //set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
    var display_url=0
    
    
    function showmenuie5(){
    //Find out how close the mouse is to the corner of the window
    var rightedge=document.body.clientWidth-event.clientX
    var bottomedge=document.body.clientHeight-event.clientY
    
    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<ie5menu.offsetWidth)
    //move the horizontal position of the menu to the left by it's width
    ie5menu.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth
    else
    //position the horizontal position of the menu where the mouse was clicked
    ie5menu.style.left=document.body.scrollLeft+event.clientX
    
    //same concept with the vertical position
    if (bottomedge<ie5menu.offsetHeight)
    ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight
    else
    ie5menu.style.top=document.body.scrollTop+event.clientY
    
    ie5menu.style.visibility="visible"
    return false
    }
    
    function hidemenuie5(){
    ie5menu.style.visibility="hidden"
    }
    
    function highlightie5(){
    if (event.srcElement.className=="menuitems"){
    event.srcElement.style.backgroundColor="#DCDCDC"
    event.srcElement.style.color="black"
    if (display_url==1)
    window.status=event.srcElement.url
    }
    }
    
    function lowlightie5(){
    if (event.srcElement.className=="menuitems"){
    event.srcElement.style.backgroundColor="#F5F5F5"
    event.srcElement.style.color="black"
    window.status=''
    }
    }
    
    function jumptoie5(){
    if (event.srcElement.className=="menuitems"){
    if (event.srcElement.getAttribute("target")!=null)
    window.open(event.srcElement.url,event.srcElement.getAttribute("target"))
    else
    window.location=event.srcElement.url
    }
    }
    </script>
    </head>
    
    <body>
    <!--[if IE]>
    <div id="ie5menu" class="skin0" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5()">
    <div class="menuitems" url=""><u><b>Welcome</b></u></div>
    <div class="menuitems" url="http://blah.com">Home</div>
    <div class="menuitems" url=""><u><b>Tutorials</b></u></div>
    <div class="menuitems" url="http://blah.com">HTML</div>
    <div class="menuitems" url="http://blah.com">XHTML</div>
    <div class="menuitems" url="http://blah.com">CSS</div>
    <div class="menuitems" url="http://blah.com">JavaScript</div>
    <div class="menuitems" url="http://blah.com">PHP</div>
    <div class="menuitems" url=""><u><b>Resources</b></u></div>
    <div class="menuitems" url="http://blah.com">Web Tools</div>
    <div class="menuitems" url="http://blah.com">Graphics</div>
    <div class="menuitems" url="http://blah.com">Free Scripts</div>
    <div class="menuitems" url="http://blah.com">Script Tut's</div>
    <div class="menuitems" url="http://blah.com">Money</div>
    <div class="menuitems" url="http://blah.com">Hosting</div>
    <hr bgcolor="#F5F5F5">
    <div class="menuitems" url="mailto:DerekPetersen1@hotmail.com">Email Us</div>
    </div>
    <![endif]-->
    <script language="JavaScript1.2">
    if (document.all&&window.print){
    if (menuskin==0)
    ie5menu.className="skin0"
    else
    ie5menu.className="skin1"
    document.oncontextmenu=showmenuie5
    document.body.onclick=hidemenuie5
    }
    </script>
    
    </body>
    </html>

  8. #8
    benzden's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2002
    Location
    San Antonio, Texas
    Posts
    652
    Having no right clicks on a page makes one wonder why the person is uploading to the internet at all. It's like someone who keeps telling you they know something about you but then won't tell you what it is - you learn to ignore everything such a person says after a while.



Tags for this Thread