Posts Tagged ‘ Javascript ’

firing client validation before client confirmation in asp.net

Client Side Confirmation is simple one using Java Script, Just write this single line in OnClienClick Properties of your Submit Button and set up Client Confirmation Box at Button Click Event.


return confirm('Do you want add this Problem?');

Now, when you have Java Script validation in your page this kind of Client Confirmation will create difficulties. More specifically, at Button Click Confirmation Box will will appear first, if client click Ok Button, Web Page will be submitted to server skipping Client Side Validation. Continue reading

Advertisements

Javascript to disable Right Click

This is an handy script to disable right click in webpages. Just put this script in between javascript tag and have right click disabled on your webpage.


     var message="Sorry, Right Click is disabled.";
   //To disable the right click on the page
    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;

Thanks
A Rahim Khan