"multimatum2" <mu*********@voila.fr> wrote in message news:<10***************@iris.uk.clara.net>...
Hello,
I need to enable/disable input text forms...
But...
I need to have the same style (color...) in both modes..
Could you help me ?
Thanx a lot
A small sample...
NAME : <input type="text" ID="I1" name="I1" size="21"
Well, I try to avoid duplicating id and name field names.
style="text-align:center;color:#00FF00;">
<BR><BR>
<A HREF="javascript:" onClick="javascript:I1.disabled=true">Disable</A>
User's expect an anchor tag to take them to another page. I like to
use a button for this.
There are two sytle attributes for hidding things: display and
visibility. When a tag is hidden with display, no screen space is
taken. When a tag is hidden with visiblity, the text disappears, but
screen space is taken.
How to hide the name too? Put what you want to hide in a division or
span tag.
I'll enclose an example:
<HTML>
<HEAD>
<TITLE>Visibility test</TITLE>
</HEAD>
<SCRIPT TYPE="text/javascript">
function toggleVisibility(theId,theDisplay)
{
// Check if the getElementById method is available
if (document.getElementById)
{
document.getElementById(theId).style.visibility = theDisplay;
}
else if (document.all)
{
alert("Running an older version of IE.");
document.all[theId].style.visibility = theDisplay;
}
else
{ alert("Cannot change visibility of field"); }
}
</SCRIPT>
<BODY>
<form>
NAME :
<input type="text"
ID="I1"
name="I1name"
size="21"
style="text-align:center;color:#00FF00;">
<BR><BR>
<input TYPE=BUTTON
NAME="cmdDisable"
VALUE="Disable"
onClick="toggleVisibility('I1','hidden');">
<BR>
<BR>
<input TYPE=BUTTON
NAME="cmdEnable"
VALUE="Enable"
onClick="toggleVisibility('I1','visible');">
</form>
</BODY>
</HTML>