Hi! can anyone help in enabling and disabling hyperlinks?. Question1: There is a frame set containing 2 frames a source frame containing 1.jsp and a destination frame containing 2.jsp. depending on a checkbox in 1.jsp a hyper link in 1.jsp should be enabled.And when the link is enabled only the page 2.jsp should be displayed in frame 2. Otherwise 2.jsp should not be displayed in frame2
Following code is contained in the body of 0.jsp <html> <head> <frameset cols="50%,*"> <frame id="sourceframe" name="sourceframe" src="./1.jsp"></frame> <frame id="resultframe" name="resultframe" src="./2.jsp"></frame> <BASE TARGET="resultframe"> </frameset> </head> <body> </body> </html> following code is contained in 1.jsp <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link href="./css/calendar.css" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Mother Earth's Arc for pets</title> </head> <body> <script language="javaScript" type="text/javascript" src="calendar.js"> function disableLink() { document.getElementById('listOfOwners').disabled=true; document.getElementById('listOfOwners').removeAttribute('href'); document.getElementById('listOfOwners').style.textDecoration = 'none'; document.getElementById('listOfOwners').style.cursor = 'default'; } function showLink() { document.getElementById('listOfOwners').disabled=false; //assign href dynamically document.getElementById(listOfOwners.ClientId).href = "2.jsp"; //document.getElementById("listOfOwners").setAttribute(href,"2.jsp"); document.getElementById("listOfOwners").style.textDecoration = "underline"; document.getElementById("listOfOwners").style.cursor = "hand"; }*/ function shouldDisplayOwnerDetailsOrNot(){ //if(document.formPet.ownerExists.checked==true) //{ frames['resultframe'].location.href = '2.jsp'; alert("hello"); //showLink(); return true; //ownerLink_Enabled_Flag = true; //} /* else{ frames['resultframe'].location.href = ''; //disableLink(); return false; //ownerLink_Enabled_Flag = false; } */ } <form name="formPet" action="Test.jsp" method="POST" onSubmit=""> <table border="1" cellspacing="0" cellpadding ="0"> <tr> <td><b>Owner Exists </b></td> <td><b><input type="checkbox" id="ownerExists" name="ownerExists" value="true" checked>Owner Exists<br> </b></td> </tr> <tr> <td><b>ListOfOwners </b></td> <td><input type="button" value="List Of Owners" id="listOfOwners" name="listOfOwners" onClick = "shouldDisplayOwnerDetailsOrNot();" target="resultframe" > </td> </tr> </table> <input type="submit" value="Submit" ><br> </form> </body> </html> Please correct the code above if possible. Question 2: Is there a solution using Java script only to achieve the problem described in http://www.webdeveloper.com/forum/showthread.php?t=174839 Or do we need to use php or any other scripting language