PDA

View Full Version : Toggle b/w two Hyperlinks using javascript:



js07
05-03-2012, 07:27 AM
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";
//document.getElementById('javaFun') calling java func from javascript
display=2;
}
else {
document.getElementById("sv1").style.display = "block";
document.getElementById("dw1").style.display = "none";
//document.getElementById('javaFun1') calling java func from javascript
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....?