aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Please help me to enable and disable anchor tag Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Please help me to enable and disable anchor tag " Watch "Please help me to enable and disable anchor tag " New topic
Author

Please help me to enable and disable anchor tag

praveen michael
Greenhorn

Joined: May 15, 2009
Posts: 2
I have a problem in disabling anchor tag.

Let me tell the scenario...

I have a page that contains a checkbox and two button images inside two anchor tags.

<table>
<tr>
<td><input type="checkbox" id="chk1">I Agree</td>
</tr>
</table>

<div>
<a ><img />Submit</a>
<a ><img />Reset</a>
</div>

- This submit button should be disabled by default.
when clicks on checkbox it should enable.

- When click on the reset it has to uncheck the check box and disable the submit button.
- Please make this code for IE and firefox
Can you please anyone help me?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

The most easy way would be , but not sure if this is efficient way :wink:
[code]

function call() { // call this function from checkbox
var a= document.getElementById("a1");
a.href="/link2";
}

<a id="a1" >Submit</a>
<a id="a2" >Reset</a>

[/code]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8439

Have you considered dropping the anchor? Around 200 fathoms of chain should do.


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
praveen michael
Greenhorn

Joined: May 15, 2009
Posts: 2
Can you please elaborate the code??

I have to set the submit anchor tag disabled true first.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Do not set the href for anchor tag. It would look like disabled.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56202
    
  13

Please take the time to choose the correct forum for your posts. This forum is for meaningless drivel posts. For more information, please read this.

This post has been moved to a more appropriate forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56202
    
  13

Balu Sadhasivam wrote:Do not set the href for anchor tag. It would look like disabled.
Not so. It will simple appear as normal text in most browsers.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56202
    
  13

<a ><img />Submit</a>

What is up with this construct? is this really the way you have your HTML arranged? Really? If so, why?

Why aren't you using a real button element?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Bear Bibeault wrote:
Balu Sadhasivam wrote:Do not set the href for anchor tag. It would look like disabled.
Not so. It will simple appear as normal text in most browsers.


yeah i meant that
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Please help me to enable and disable anchor tag
 
Similar Threads
anchor tag with pound sign
layout and multibrowser hell
Help me about html:select
clear the field and disable the back button.
Need Help with Jquery Selector logic