44 lines
978 B
Plaintext
44 lines
978 B
Plaintext
|
<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>
|