calling for help from windows.open experts

Discussion in 'JavaScript' started by YourChild, Jun 24, 2008.

  1. #1
    very simple question..

    what is the syntax used to access a window by its name?


    say my code looks like this:

    
    function openNewWindow(winName){
    	
    	newWindow = window.open('',winName,'width=450,height=300,resizable=yes,scrollbars=no,toolbars=no,top=50,left=100');
    	content = "<html><head>";
    	content += "<script src='js.js'></script>";
    	content += "</head>";
    	content += "<body><a href='javascript:;' onclick=\'editWindow(\""+newWindow+"\")\'>edit my window</a></body>";
    	content += "</html>";
    	
    	newWindow.document.write(content);
    	newWindow.document.close();
    	
    }
    
    Code (markup):

    function editWindow(newWindow) inside js.js receives newWindow as a window object but when I try to do

    newWindow.focus() inside js.js, it says newWindow.focus() is not a function?
     
    YourChild, Jun 24, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175