如何在页面上多次使用此代码

嗨,你好啊.我目前在我的网站上工作,我想知道如何才能在页面上多次使用此代码

选择 | 换行 | 行号
  1. <script language="JavaScript">
  2. <!-- 
  3. // This is the function that will open the
  4. // new window when the mouse is moved over the link
  5. function open_new_window() 
  6. {
  7. new_window = open("","hoverwindow","width=300,height=200,left=10,top=10");
  8.  
  9. // open new document 
  10. new_window.document.open();
  11.  
  12. // Text of the new document
  13. // Replace your " with ' or \" or your document.write statements will fail
  14. new_window.document.write("<html><title>JavaScript New Window</title>");
  15. new_window.document.write("<body bgcolor=\"#FFFFFF\">");
  16. new_window.document.write("This is a new html document created by JavaScript ");
  17. new_window.document.write("statements contained in the previous document.");
  18. new_window.document.write("<br>");
  19. new_window.document.write("</body></html>");
  20.  
  21. // close the document
  22. new_window.document.close(); 
  23. }
  24.  
  25. // This is the function that will close the
  26. // new window when the mouse is moved off the link
  27. function close_window() 
  28. {
  29. new_window.close();
  30. }
  31.  
  32. // -->
  33. </script>
  34.  
  35.  
  36. <a href="#" onMouseOver="open_new_window()" onMouseOut="close_window()">Open Hover Window</a>

标签: Javascript

添加新评论