| Author: gomathinayagam 15 Oct 2008 | Member Level: Gold | Rating: Points: 0 |
use javascript to do that. i give here a sample:
<input name="textfield3" type="text" class="textBox" id="textfield3" style="color: #cccccc; width: 129px;" onfocus="cler()" onblur="addtxt()" value="e-mail:" runat="server" />
java script function
<script language="javascript" type="text/javascript"> function cler(){ if(document.getElementById('<% = textfield3.ClientID %>').value=='e-mail:') { document.getElementById('<% = textfield3.ClientID %>').value=""; document.getElementById('<% = textfield3.ClientID %>').style.color="#1c6b99"; }
function addtxt(){ if(document.getElementById('<% = textfield3.ClientID %>').value=="") { document.getElementById('<% = textfield3.ClientID %>').value='e-mail:'; document.getElementById('<% = textfield3.ClientID %>').style.color="#cccccc"; }
</script>
is it working?? i used that so it must work! wat ur problem?
Gomathi Nayagam
Please Rate my answer if it has helpful to you
|
| Author: Miss Meetu Choudhary 15 Oct 2008 | Member Level: Diamond | Rating:  Points: 2 |
use InnerHTML or InnerText for that
== Thanks and Regards Meetu Choudhary
Thanks and Regards Miss Meetu Choudhary (Site Coordinator) Go Green Save Green My Profile on Google
|
| Author: gomathinayagam 16 Oct 2008 | Member Level: Gold | Rating:  Points: 2 |
the same code will working for textarea also!! use like here
<textarea id="textfield4" runat="server" class="textBox" name="textfield4" onblur="addtxt1();" onfocus="cler1();" rows="4" style="width: 129px; color: #cccccc">Feedback:</textarea>
function cler1(){ if(document.getElementById('<% = textfield4.ClientID %>').value=='Feedback:') { document.getElementById('<% = textfield4.ClientID %>').value=""; document.getElementById('<% = textfield4.ClientID %>').style.color="#1c6b99"; } } function addtxt1(){ if(document.getElementById('<% = textfield4.ClientID %>').value=="") { document.getElementById('<% = textfield4.ClientID %>').value='Feedback:'; document.getElementById('<% = textfield4.ClientID %>').style.color="#cccccc"; } }
Gomathi Nayagam
Please Rate my answer if it has helpful to you
|