开发者

Watermark text in asp.net?

in my web application i am using javascript for water mark text in textboxes it is working fine but for textbox if TextMode property set to Multiline then the water mark text is not displaying is there any particular reason. this is my code...

<TextBox ID="txtone" runat="server" tooltip="Enter comments"
 onblur="if(this.value=='') this.value='Enter text,150 chara开发者_运维知识库cters only';"
 onfocus="if(this.value == 'Enter text,150 characters only') this.value='';" 
 value="Enter text,150 characters only">
</TextBox>


When a TextBox is in multiline mode, it's rendered as a textarea instead of an input element. The textarea element doesn't use the value attribute, so your code fails to set the initial value.

Use the Text property of the server control instead of the value argument of the client control:

<TextBox ID="txtone" runat="server" tooltip="Enter comments"
onblur="if(this.value=='') this.value='Enter text,150 characters only';"
onfocus="if(this.value == 'Enter text,150 characters only') this.value='';"
Text="Enter text,150 characters only"></TextBox>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜