Source code of Windows XP (NT5)
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

  1. <PUBLIC:COMPONENT lightweight>
  2. <PUBLIC:PROPERTY name="initialText" />
  3. <PUBLIC:ATTACH event="ondocumentready" onevent="OnInit();" />
  4. <PUBLIC:ATTACH event="onfocus" onevent="OnFocus()" />
  5. <PUBLIC:ATTACH event="onblur" onevent="OnBlur()" />
  6. <SCRIPT language="JavaScript">
  7. function OnInit()
  8. {
  9. // Inherit some styles that normally don't get inherited onto an edit box
  10. var parentStyle = this.parentElement.currentStyle;
  11. this.style.fontFamily = parentStyle.fontFamily;
  12. this.style.fontSize = parentStyle.fontSize;
  13. this.style.color = parentStyle.color;
  14. if (this.type == 'password')
  15. initialText = '';
  16. else if (initialText == null)
  17. initialText = 'Click here to type';
  18. this.value = initialText;
  19. }
  20. function OnFocus()
  21. {
  22. if (this.value == initialText)
  23. this.value = '';
  24. this.createTextRange().select();
  25. }
  26. function OnBlur()
  27. {
  28. if (this.value == '')
  29. this.value = initialText;
  30. }
  31. </SCRIPT>
  32. </PUBLIC:COMPONENT>