macaddress.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head></head>
  4. <body>
  5. <a href="#" onclick="macs.getMacAddress();"> Get"first"MAC Address</a>
  6. <br/>
  7. <br/>
  8. <a href="#" onclick="macs.getMacAddressesJSON();"> Get all MAC Addresses</a>
  9. <!--[if !IE]> Firefox and others will use outer object -->
  10. <embed type="application/x-java-applet"
  11. name="macaddressapplet"
  12. width="0"
  13. height="0"
  14. code="MacAddressApplet"
  15. archive="macaddressapplet.jar"
  16. pluginspage="http://java.sun.com/javase/downloads/index.jsp"
  17. style="position:absolute; top:-1000px; left:-1000px;">
  18. <noembed>
  19. <!--<![endif]-->
  20. <!---->
  21. <object classid="clsid:CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA"
  22. type="application/x-java-applet"
  23. name="macaddressapplet"
  24. style="position:absolute; top:-1000px; left:-1000px;"
  25. >
  26. <param name="code"value="MacAddressApplet">
  27. <param name="archive"value="macaddressapplet.jar">
  28. <param name="mayscript"value="true">
  29. <param name="scriptable"value="true">
  30. <param name="width"value="0">
  31. <param name="height"value="0">
  32. </object>
  33. <!--[if !IE]> Firefox and others will use outer object -->
  34. </noembed>
  35. </embed>
  36. <!--<![endif]-->
  37. <script type="text/javascript">
  38. var macs = {
  39. getMacAddress : function()
  40. {
  41. document.macaddressapplet.setSep("-");
  42. alert("Mac Address ="+ document.macaddressapplet.getMacAddress() );
  43. },
  44. getMacAddressesJSON : function()
  45. {
  46. document.macaddressapplet.setSep(":");
  47. document.macaddressapplet.setFormat("%02x");
  48. var macs = eval( String( document.macaddressapplet.getMacAddressesJSON() ) );
  49. var mac_string ="";
  50. for( var idx = 0; idx < macs.length; idx ++ )
  51. mac_string +="t"+ macs[ idx ] +"n";
  52. alert("Mac Addresses = n"+ mac_string );
  53. }
  54. }
  55. </script>
  56. </body>
  57. </html>