Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disabling Rightclick_ popup window

    Hi everybody,
    Can anyone please help me with javascript concern. Iam getting image popup window alright but I dont wont someone copy my image.Ofcourse there are other ways to copy images (like screen shots)..but atleast to created some sort of caution to the visitors who try to copy the images. Below is the code for image popup window...but I want to disable the right click in image popup window. Please help me out....
    Advance thanks for any help!

    <td>
    <a href="#"><img src="images/gallery/T_BabagangapurArthirudram.jpg" alt="baba gangapur arthirudram" width="141" height="141" border="0" onClick="MM_openBrWindow('images/gallery/BabagangapurArthirudram.jpg','BabaGangapurArthirudram','status=yes,width=420,height=276')"></a>
    </td>

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Location
    Preston, Lancashire, England
    Posts
    285
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this seems to work for me
    Code:
    <script language=JavaScript>
    function clickIE4(){
    if (event.button==2){
    alert(message);
    return false;
    }
    }
    
    function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    alert(message);
    return false;
    }
    }
    }
    
    if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS4;
    }
    else if (document.all&&!document.getElementById){
    document.onmousedown=clickIE4;
    }
    
    document.oncontextmenu=new Function("return false")
    </script>

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you MRMAN,
    Copied the code...Where should I place this? In header part? Iam trying.
    Regards
    Ramakrishna

  • #4
    New Coder
    Join Date
    Jan 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi MRMAN!

    The following is the code for disabling righclick for main window. This code I had as .js file in the directory of htmls. Main window showing disable rightclick alright. But I want right click disable for image popup window. I tried.. your code is not working for me! Any othercodes can you suggest?


    <!--

    function disable_right_click(e)
    {
    var browser = navigator.appName.substring ( 0, 9 );
    var event_number = 0;
    if (browser=="Microsoft")
    event_number = event.button;
    else if (browser=="Netscape")
    event_number = e.which;

    if ( event_number==2 || event_number==3 )
    {
    alert ("All Image Copyrights Reserved for \nDigital Dental Strategies, Inc.");
    return (false);
    }

    return (true);
    }

    function trap_images_mouse_events ()
    {
    if ( document.images )
    {
    for (var pic=0; pic<document.images.length; pic++)
    document.images[pic].onmousedown = disable_right_click;
    }
    }

    var debug = true;
    function right(e)
    {
    var today = new Date();
    yr = "2001";

    nextyr = today.getYear();

    if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
    alert('Thank you for visiting! Copyrighted content of Dattagru Bhandara Trust (Regd).\n Copyright ' + yr + '-' + nextyr);
    return false;
    }

    else if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
    x = String(yr);
    y = String(nextyr)
    x = x.substring(1,3);
    y = y.substring(1,3);
    alert('Copyright&#169; 20' + x + '-20' + y);
    return false;
    }

    return true;
    }

    document.onmousedown=right;
    if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    window.onmousedown=right;

    function PopUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'width=630,height=471,left=10,top=10,toolbar=no,location=no,status=no,menubar=no,resizable=no');");
    }
    //-->


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •