mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
978 B
43 lines
978 B
<PUBLIC:COMPONENT lightweight>
|
|
|
|
<PUBLIC:PROPERTY name="initialText" />
|
|
|
|
<PUBLIC:ATTACH event="ondocumentready" onevent="OnInit();" />
|
|
<PUBLIC:ATTACH event="onfocus" onevent="OnFocus()" />
|
|
<PUBLIC:ATTACH event="onblur" onevent="OnBlur()" />
|
|
|
|
<SCRIPT language="JavaScript">
|
|
|
|
function OnInit()
|
|
{
|
|
// Inherit some styles that normally don't get inherited onto an edit box
|
|
var parentStyle = this.parentElement.currentStyle;
|
|
this.style.fontFamily = parentStyle.fontFamily;
|
|
this.style.fontSize = parentStyle.fontSize;
|
|
this.style.color = parentStyle.color;
|
|
|
|
if (this.type == 'password')
|
|
initialText = '';
|
|
else if (initialText == null)
|
|
initialText = 'Click here to type';
|
|
|
|
this.value = initialText;
|
|
}
|
|
|
|
function OnFocus()
|
|
{
|
|
if (this.value == initialText)
|
|
this.value = '';
|
|
|
|
this.createTextRange().select();
|
|
}
|
|
|
|
function OnBlur()
|
|
{
|
|
if (this.value == '')
|
|
this.value = initialText;
|
|
}
|
|
|
|
</SCRIPT>
|
|
|
|
</PUBLIC:COMPONENT>
|