Toggle b/w two Hyperlinks using javascript:

Discussion in 'JavaScript' started by gopal07, May 2, 2012.

  1. #1
    Below are my script to toggle b/w two different links,

    <html lang="en-US">
    <head>
    <title>toggle b/w 2 different links</title>
    <script type="text/javascript"><!--
    display=1;
    function displayvalue()
    {
    document.getElementById("sv1").style.display = "block";
    document.getElementById("dw1").style.display = "none";
    }
    function ShowHide()
    {
    if (display==1) {
    document.getElementById("sv1").style.display = "none";
    document.getElementById("dw1").style.display = "block";
    display=2;
    }
    else {
    document.getElementById("sv1").style.display = "block";
    document.getElementById("dw1").style.display = "none";
    display=1;
    }
    }
    function Func1Delay()
    {
    document.getElementById("sv1").style.display = "none";
    document.getElementById("loadimage").innerHTML="<input type='image' src='Loading.gif'>";
    setTimeout("LoadImage()", 300);
    }


    function LoadImage()
    {
    document.getElementById("loadimage").innerHTML="";
    ShowHide();
    }


    --></script>
    </head>
    <body background="GsNJNwuI-UM.gif"onload="displayvalue()">


    <div id="sv1" >
    <a onclick ="Func1Delay()" href="javascript:;">click me</a>
    </div>
    <div id="loadimage"></div>
    <div id="dw1" >
    <a onclick ="ShowHide()" href="javascript:;">Download me</a>
    </div>
    </body>
    </html>

    whenever we call a java method , (consider this line:- document.getElementById('javaFun');)after the completion of java call the page is reloading, how control this reloading after the server completing the request....?
     
    gopal07, May 2, 2012 IP