Browser Javascript tips and tricks for improving Your business application GUI
All credits to original authors....

All theses examples have to be put in the body onload="" tag of Your pages....

More in the javascript section....
  •  How to deactivate the F5 button (RELOAD page) IEonly
    function avoidF5key(){
    if (document.all) {
    document.onkeydown = function (){
    var key_f5 = 116; // 116 = F5
    if (key_f5==event.keyCode) {
    event.keyCode=0;
    return false;
    }
    return true;
    }
    }
    }
  • How to deactivate the back button (SUPPR or history back) All

    function disableBackButton(){
    history.forward(); }

  • How to change images when the user hover on them All


    usage:

    <img src="image1.jpg" hsrc="image2.jpg">

    function changeImageOnHover() {

    if (!document.getElementById) return
    var imgOriginSrc;
    var imgTemp = new Array();
    var imgarr = document.getElementsByTagName('img');
    for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
    imgTemp[i] = new Image();
    imgTemp[i].src = imgarr[i].getAttribute('hsrc');
    imgarr[i].onmouseover = function() {
    imgOriginSrc = this.getAttribute('src');
    this.setAttribute('src',this.getAttribute('hsrc')) }
    imgarr[i].onmouseout = function() {
    this.setAttribute('src',imgOriginSrc) }
    }
    }
    }

  • How to deactivate the contextual menu (Right-Click) All

  • How to display a moving slider which distract user during long server operations

    Method1
    Usage:


    Put this code anywhere in Your page:

    <DIV ID="splashScreen" STYLE="position:absolute;z-index:5;top:30%;left:35%;">
    <TABLE BGCOLOR="000000" BORDER=1 BORDERCOLOR="000000"
    CELLPADDING=0 CELLSPACING=0 HEIGHT=100 WIDTH=100>
    <TR>
    <TD WIDTH="10%" HEIGHT="10%" BGCOLOR="CCCCCC" ALIGN="CENTER" VALIGN="MIDDLE">
    <BR><BR>
    <IMG SRC="/ofev/wait/rotatinghpvlogo.gif"><BR><FONT FACE="Helvetica,Verdana,Arial" SIZE=3 COLOR="000066"><B>Page Loading. Please wait...</B></FONT><BR><IMG SRC="/ofev/wait/wait.gif" BORDER=1 WIDTH=75 HEIGHT=15><BR><BR>
    <BR><BR> </TD>

    </TR>
    </TABLE>
    </DIV>

    Put this code in your submit function:

    function myubmit(MyForm){ startPleaseWait(); document.forms[MyForm].submit();}
    }


    put this code in your Body onload:

    onload=stopPleaseWait();


    Code:


    //autodetection of browser
    // IE 5 and up, NS 6 and up
    if(document.getElementById) { var upLevel = true; }
    else // Netscape 4
    if(document.layers) { var ns4 = true; }
    else


    //IE 4
    if(document.all) { var ie4 = true; }

    function showObject(obj) {
    if (ns4) { obj.visibility = "show"; }
    else


    if (ie4 || upLevel) { obj.style.visibility = "visible"; }
    }
    function hideObject(obj) {
    if (ns4) { obj.visibility = "hide"; }
    else
    if (ie4 || upLevel) { obj.style.visibility = "hidden"; }
    }


    //start the please wait popup windows
    function startPleaseWait()


    {
    if(upLevel) {
    var splash = document.getElementById("splashScreen");
    }
    else if(ns4) {
    var splash = document.splashScreen;
    }
    else if(ie4) {
    var splash = document.all.splashScreen;
    }
    if (splash != null)


    showObject(splash);
    }


    //stop the please wait popup windows
    function stopPleaseWait()


    {
    if(upLevel) {
    var splash = document.getElementById("splashScreen");
    }
    else if(ns4) {
    var splash = document.splashScreen;
    }
    else if(ie4) {
    var splash = document.all.splashScreen;
    }
    if (splash != null)


    hideObject(splash);
    }

    // avoid refresh of page (key F5) only working in IE
    function avoidF5key()


    {
    if (document.all) {

    document.onkeydown = function (


    {
    var key_f5 = 116; // 116 = F5
    if (key_f5==event.keyCode)


    {
    event.keyCode=0;
    return false;
    }
    return true;
    }
    }
    }



comments powered by Disqus

You might like also

javascript to the limits
This game has been rewrite in javascript and is more than playable. Enjoy going back to the root like me: I use to play lemmings on a 486DX 50Mhz 15 Years Ago...Lemmings™ is an intriguing game in which you help hordes of otherwise-mindless creatures - knows as walkers - escape hostile environments. …
4625 Days ago
No Thumbnail was found
Persistent or session cookies can be set...You can also set the path...A lot of options, see the comments from the authorsA very powerful script!!!!! //------------------------------------------------------------------------------ // TopDragon CookieJar(tm) //------------------------------------------------------------------------------ // A Javascript CookieJar object with associated methods for using cookies. // // Copyright 2001 by TopDragon Software (www.bydisn.com or This email address is being protected from spambots. You need JavaScript enabled to view it.). // // This code isn't shareware, it's absolutely free. But if you really want to // (or if your conscience bugs you) feel free to send cash, gifts, liquor, // …
5245 Days ago
No Thumbnail was found
domTableEnhance is a script that turns every table with a special class into an enhanced one. The tables enhanced by domTableEnhance will have an alternate row colour and have a rollover on each row that includes cells (header rows won't get a rollover). domTableenhance adds these effects by applying classes to the rows, which means that you don't need to know any Javascript to change the look. More here at the official homepage …
5245 Days ago
No Thumbnail was found
OverliboverLIB is a JavaScript library created to enhance websites with small popup information boxes (like tooltips) to help visitors around your website. It can be used to provide the user with information about what will happen when they click on a link.You want to see this free script in action? more here at the official Homepage …
5245 Days ago
No Thumbnail was found
http://waltercedric.com/java/gathertInformationsWJavascrip.htmlsave page as t have source code …
5413 Days ago
No Thumbnail was found
all credits to Authors keywords table html scrolling rows body Purpose If you want to create a table with a fixed header row and a scrolling body. Links: http://www.htmlcodetutorial.com/tables/ all about tables http://www.w3.org/TR/REC-html40/struct/tables.html Examples of advanced layouts in HTML tables http://www.htmlhelp.com/reference/html40/tables/table.html by web design group http://www.blooberry.com/indexdot/html/tagpages/tables.htm = Index DOT Html by Brian Wilson = http://www.w3schools.com/css/pr_pos_overflow.asp overflow Using Iframe http://www.htmlcodetutorial.com/frames/_IFRAME.html Changing color of slider (using css) body W3C compliant but as usual not working in IE ;-) NS4 VIEW HERE Fixed …
5413 Days ago