Leaked source code of windows server 2003
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.

155 lines
2.9 KiB

  1. // *************************************************************************
  2. // UDDI Services
  3. // Copyright (c) 2002 Microsoft Corporation
  4. // All Rights Reserved
  5. // *************************************************************************
  6. var GetElementById = GetElementById_Initialize;
  7. function GetElementById_Initialize( id )
  8. {
  9. if( null != document.getElementById ) // DOM level 1 conformance
  10. {
  11. GetElementById = function( id )
  12. {
  13. return document.getElementById( id );
  14. }
  15. }
  16. else if( null != document.all ) // IE 4.x browsers
  17. {
  18. GetElementById = function( id )
  19. {
  20. return document.all[ id ];
  21. }
  22. }
  23. else if( null != document.layers ) // Netscape 4.0 browsers
  24. {
  25. GetElementById = function( id )
  26. {
  27. return GetElementById_Netscape4( id );
  28. }
  29. }
  30. else // No support
  31. {
  32. GetElementById = function( id )
  33. {
  34. return null;
  35. }
  36. }
  37. return GetElementById( id );
  38. }
  39. function GetElementById_Netscape4( id )
  40. {
  41. var i;
  42. //
  43. // Check the form elements collection. Since we only have
  44. // one form in ASP.NET, we only need to search the first
  45. // form in the collection.
  46. //
  47. for( i = 0; i < document.forms[ 0 ].length; i ++ )
  48. {
  49. var e = document.forms[ 0 ].elements[ i ];
  50. if( e.name && id == e.name )
  51. return e;
  52. }
  53. //
  54. // As a last attempt, check the layers collection for the
  55. // element.
  56. //
  57. return document.layers[ id ];
  58. }
  59. function SetFocus( id )
  60. {
  61. var e = GetElementById( id );
  62. if( null != e && null != e.focus )
  63. e.focus();
  64. }
  65. function Select( id )
  66. {
  67. var e = GetElementById( id );
  68. if( null != e )
  69. {
  70. if( null != e.focus )
  71. e.focus();
  72. if( null != e.select )
  73. e.select();
  74. }
  75. }
  76. function CancelEvent( e )
  77. {
  78. e.cancelBubble = true;
  79. e.returnValue = false;
  80. }
  81. function Document_OnContextMenu()
  82. {
  83. var e = window.event;
  84. if( e != null )
  85. CancelEvent( e );
  86. }
  87. function ShowHelp( url )
  88. {
  89. window.open( url, null, "height=500,width=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes" );
  90. }
  91. function ShowQuickHelp( id )
  92. {
  93. var e = GetElementById( id );
  94. //
  95. // ASP.NET uses a different format for id and name. We first search
  96. // using the name, then id.
  97. //
  98. if( null == e )
  99. e = GetElementById( id.replace( ":", "_" ) );
  100. if( null != e )
  101. {
  102. var i = e.selectedIndex;
  103. var url = e.options[ i ].value;
  104. ShowHelp( url );
  105. }
  106. }
  107. function MenuItem_Action( sender, action, name )
  108. {
  109. if( null!=sender )
  110. {
  111. switch( action.toLowerCase() )
  112. {
  113. case "leave":
  114. if( sender.className!=name+"_ItemSelected" )
  115. {
  116. sender.className=name+"_Item";
  117. }
  118. break;
  119. case "enter":
  120. if( sender.className!=name+"_ItemSelected" )
  121. {
  122. sender.className=name+"_ItemHovor";
  123. }
  124. break;
  125. default:
  126. alert( "Unknown action: " + action );
  127. break;
  128. }
  129. }
  130. }