How do I use this code multiple times on a page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joshechevarria
    New Member
    • Apr 2014
    • 1

    #1

    How do I use this code multiple times on a page

    Hi there. Working on my site currently and I would like to know how I can use this code more than once on the page

    Code:
    <script language="JavaScript">
    <!-- 
    // This is the function that will open the
    // new window when the mouse is moved over the link
    function open_new_window() 
    {
    new_window = open("","hoverwindow","width=300,height=200,left=10,top=10");
    
    // open new document 
    new_window.document.open();
    
    // Text of the new document
    // Replace your " with ' or \" or your document.write statements will fail
    new_window.document.write("<html><title>JavaScript New Window</title>");
    new_window.document.write("<body bgcolor=\"#FFFFFF\">");
    new_window.document.write("This is a new html document created by JavaScript ");
    new_window.document.write("statements contained in the previous document.");
    new_window.document.write("<br>");
    new_window.document.write("</body></html>");
    
    // close the document
    new_window.document.close(); 
    }
    
    // This is the function that will close the
    // new window when the mouse is moved off the link
    function close_window() 
    {
    new_window.close();
    }
    
    // -->
    </script>
    
    
    <a href="#" onMouseOver="open_new_window()" onMouseOut="close_window()">Open Hover Window</a>
    Last edited by Rabbit; Apr 23 '14, 03:45 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...