enabling and disabling a hyperlinks using javascript only

enabling and disabling a hyperlinks using javascript only

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
View Answers









Related Tutorials/Questions & Answers:
enabling and disabling a hyperlinks using javascript only
enabling and disabling a hyperlinks using javascript only  Hi! Anyone can help in enabling and disabling a hyperlinks?. Question1: There is a frame.... Question 2: Is there a solution using Java script only to achieve the problem
enabling and disabling a hyperlinks using javascript only
enabling and disabling a hyperlinks using javascript only  Hi! can anyone help in enabling and disabling hyperlinks?. Question1: There is a frame set... be enabled.And when the link is enabled only the page 2.jsp should be displayed
Advertisements
Solve using only Javascript loops...
Solve using only Javascript loops...  Write a JavaScript code, 1) to find a number of unique letters in string. (Eg. if keyword is unique, Unique count will be '4') 2) so that numbers appear in following format, 1 1 2
Java code for enabling filter to a checkbox and disabling filter to that checkbox after uncheked
Java code for enabling filter to a checkbox and disabling filter to that checkbox after uncheked  Can anybody say the Java code for enabling filter to a checkbox and disabling filter to that checkbox after uncheked
Enabling and Disabling Button In JSF
Enabling and Disabling Button In JSF  ...; In this tutorial enabling and disabling a button on different conditions has been...; then in the next page only one "Employee Area" button
displaying a calendar of only current month in jsp on webpage using javascript
displaying a calendar of only current month in jsp on webpage using javascript  how can we display a calendar of only current month in jsp on webpage using javascript
Disabling submit button using jQuery
Disabling submit button using jQuery  Hello Sir I want to know - is there any way or approach to disable client side form's "Submit" button. Please give code also.ADS_TO_REPLACE_1   For all submit buttons, via JQuery
disabling commandlink
disabling commandlink  how can i disable commandlink through javascript. My requirement is that once the link is disabled the user should not be able to click on it. The commandlink.disabled attribute only disables the link
Date object using JavaScript
Date object using JavaScript  What's the Date object using JavaScript
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
using for loop in javascript
using for loop in javascript  How to use for loop in JavaScript
maximize an image using javaScript
maximize an image using javaScript  Write the code to maximize an image using javaScript
xls to js using javascript
xls to js using javascript  ![how can we convert a xls file in js file using javascript][1
timer using javascript
timer using javascript  How to display timer on HTML page using JavaScript
send mail using JavaScript
send mail using JavaScript  How can we send mail using JavaScript?   Hi friends, You can not send email directly using JavaScript. But you can use JavaScript to execute a client side email program send the email using
How to shift and unshift using JavaScript?
How to shift and unshift using JavaScript?  How to shift and unshift using JavaScript
read and write a file using javascript
read and write a file using javascript  How to read and write a file using javascript
checkboxes set to true using JavaScript
checkboxes set to true using JavaScript  To set all checkboxes to true using JavaScript
validate radio button using javascript
validate radio button using javascript  validate radio button using javascript
convert numbers to strings using JavaScript
convert numbers to strings using JavaScript  How to convert numbers to strings using JavaScript
Math Constants and Functions using JavaScript
Math Constants and Functions using JavaScript  What's Math Constants and Functions using JavaScript
associate functions with objects using JavaScript
associate functions with objects using JavaScript  How to associate functions with objects using JavaScript
set the focus on an element using Javascript
set the focus on an element using Javascript  How to set the focus on an element using Javascript
how to print HTML using javascript or Jquery
how to print HTML using javascript or Jquery  is there any way to print a document(created using Html and javascript) without using window.print... window.print but this required to enable pop-up and work only in firefox. and I have also
Changing background color using JavaScript
Changing background color using JavaScript  Hi Sir Is there any way to change the background color using JavaScript ? Please mention code with your answer.   Hello Friend Pass the element & color in the given
javascript date validation using regex
javascript date validation using regex  Hi, I want to validate the date using javascript. Please help.   <html> <head> <title>Validating Date format</title> <script type="text/javascript">
How to make session control using only JSP programming language
How to make session control using only JSP programming language  Could i do Controlling session using only JSP programming language without using anylanguage
creating hyperlinks in applet - Applet
creating hyperlinks in applet  Dear sir, how can i move from one applet to another applet and how can i use previous applet input data in anotherapplet(just like session tracking) thanks
how to give validation using javascript in swing
how to give validation using javascript in swing   how to give validation using javascript in swing....... can somebody give code for username and password validation using javscript and swing
How to write a search functionality using javascript/jquery
How to write a search functionality using javascript/jquery   How to write a search functionality using javascript/jquery for ex: im searching "s" names it wil display "s" names
use strings as array indexes using JavaScript
use strings as array indexes using JavaScript  How to use strings as array indexes using JavaScript
create a string from an array using JavaScript
create a string from an array using JavaScript  How to use "join()" to create a string from an array using JavaScript
force a page to go to another page using JavaScript
force a page to go to another page using JavaScript  How to force a page to go to another page using JavaScript
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
To change the color of text hyperlinks midway
To change the color of text hyperlinks midway   Is there a way to change the color of text hyperlinks midway through a page? If so, what code do I use
flowcharts using javascript/HTML - Development process
flowcharts using javascript/HTML  Hi I want to create flowchart diagram using html/javascript.. is that possible.. please guide me Thanks!  Check this linkhttp://www.roseindia.net/jdbc/jdbc-driver-and-its-types.shtml
How to select only .txt file to be zipped using java?
How to select only .txt file to be zipped using java?  Hello, i'm trying to zipp .txt files from a folder but i want to know how to select only .txt...:\\Target\\target.txt");// here i want to say only the directroy where .txt files
print this image in java code using only loop{for, if, loop}
print this image in java code using only loop{for, if, loop}  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all, I am developing a website only using jsp and html. i need to save the form data into a .csv file using jsp. can anyone give me any sample solution or tutorial
Calendar In JSP Using JavaScript
Calendar In JSP Using JavaScript   ... in JSP using JavaScript. We created the following files for the application...:150px;'><a href="javascript:window.close()">Window Close<
Hide show HTML forms using javascript
Hide show HTML forms using javascript  How to hide a HTML form in my application using JavaScript?   HTML Code to create checkbox <...;div id="yourDiv"> ...other forms... </div> JavaScript function to hide
Html form using JavaScript to display the table content
Html form using JavaScript to display the table content  HI There, Greetings, I am new to this java and I need your assistance. I have created... want to write a Html JavaScript coding to display the content from database
Enabling the textbox - Java Server Faces Questions
Enabling the textbox  Hi, I have disabled the jsf text box using JavaScript on clicking the select boolean check box and it's getting disabled too. but when I am trying to enable it again on clicking of checkbox
How to check text in textbox using JavaScript
How to check text in textbox using JavaScript  How to check text in textbox using JavaScript I have a form in HTML that contains text feilds... me.   JavaScript validation example to check text in textfeild <
Enabling remote access in Elasticsearch
Enabling remote access in Elasticsearch  Hi, I have installed.... It not accessible from other computer on port 9200. Its only accessible at http...? Thanks   Hi, Elasticsearch is by default accessible from localhost only
How to give value for select in HTML dynamically using javascript
and department. if i select a degree the departments corresponding to that degree only should be displayed in the dept list. how to do this using javascript...How to give value for select in HTML dynamically using javascript  hi
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]  HI team, This is Srinivas, and I have a query and i explained here... I have to save some datas in an MS ACCESS database file [*.mdb], after
Difficulty using javascript in server side - Java Interview Questions
Difficulty using javascript in server side   why interaction with server using javascript is difficult
how to save uploaded image in database using javascript
how to save uploaded image in database using javascript  Please can you tell me how to store uploaded image in database using java I'll use... alert("Please only upload files that end in types: " + (extArray.join

Ads