Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: SV: Re: SV: Re: SV: How to enable/disable link


Message #1 by "Robert Nyman" <robert.nyman@c...> on Wed, 16 Oct 2002 15:10:29 +0200
Yes,

You can set an attribute with the setAttribute method.

>...then give me exact function with parameters.....

The code in my previous e-mail was doing what you wanted.
You have to do some coding of your own, you know, to adapt it to your
specific needs.


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: swat [mailto:swati@m...]
Skickat: den 18 oktober 2002 09:13
Till: JavaScript HowTo
=C4mne: [javascript_howto] Re: SV: Re: SV: How to enable/disable link


hello Robert,

      can I set attribute of link by using
        document.getElementById("aLink").setAttribute()

      if yes, then give me exact function with parameters.....

swati

----- Original Message -----
From: Robert Nyman <robert.nyman@c...>
To: JavaScript HowTo <javascript_howto@p...>
Sent: Wednesday, October 16, 2002 3:31 PM
Subject: [javascript_howto] SV: Re: SV: How to enable/disable link


So change the the input button to a link...
Same code and everything, just:

function
ckVal(oElm){

document.getElementById("aLink").disabled =3D (oElm.value =3D=3D "Some
text...")? true : false;
document.getElementById("aLink").onclick =3D function (){
return (this.disabled)? false : true; // This is
necessary to disable the built-in behavior of the link
}
}


<input type=3D"text" value=3D"Some text..." onChange=3D"checkVal(this)">

<a id=3D"aLink" href=3D"http://www.google.com">A link</a>


BTW, this will only work in IE 5.5.+...


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: swat [mailto:swati@m...]
Skickat: den 16 oktober 2002 09:25
Till: JavaScript HowTo
=C4mne: [javascript_howto] Re: SV: How to enable/disable link


I  dont want button..I want link.......
----- Original Message -----
From: Robert Nyman <robert.nyman@c...>
To: JavaScript HowTo <javascript_howto@p...>
Sent: Monday, October 14, 2002 3:23 PM
Subject: [javascript_howto] SV: How to enable/disable link


function checkVal(oElm){
if(oElm.value =3D=3D "Some text..."){
document.getElementById("submitButton").disabled =3D true; } else{
document.getElementById("submitButton").disabled =3D true; } }

(or a neater version of the function:

function checkVal(oElm){
document.getElementById("submitButton").disabled =3D (oElm.value =3D=3D 
"Some
text...")? true : false; }

)

<input type=3D"text" value=3D"Some text..." onChange=3D"checkVal(this)">

<input id=3D"submitButton" name=3D"submitButton" type=3D"submit"
value=3D"Submit">


See also:
http://msdn.microsoft.com/workshop/author/d
html/reference/properties/dis
abled_2.asp


/Robert



-----Ursprungligt meddelande-----
Fr=E5n: swat [mailto:swati@m...]
Skickat: den 14 oktober 2002 07:10
Till: JavaScript HowTo
=C4mne: [javascript_howto] How to enable/disable link


hello,

   My query is

       How to enable/disable link which is on form when changes in
       Textfield?

       like u explain enabled/disabled button on form....

   reply asap

*********************************************
Great Love And Great Achievements
Involve Great Risk
*********************************************




---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 





---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 





---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20


  Return to Index