SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    function in child window won't run without refresh

    Here is my code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
      <title>TEST</title>
    
    <SCRIPT>
    
    function openindex()
          { 
    OpenWindow=window.open("", "newwin", "");
    OpenWindow.document.write("<TITLE>BRKRSRCH</TITLE>")
    OpenWindow.document.write("<HEAD>")
    OpenWindow.document.write("<SCRIPT>")
    OpenWindow.document.write("function S2CB() {  window.clipboardData.setData('Text', 'CENTURY\\r\\nAUDIT\\r\\nACCOUNTING REPORT\\r\\n\\r\\nFISCAL YEAR END');}")
    OpenWindow.document.write("<\/SCRIPT>")
    OpenWindow.document.write("</HEAD>")
    OpenWindow.document.write("<BODY onLoad='S2CB();'>")
    OpenWindow.document.write("</BODY>")
    OpenWindow.document.write("</HTML>")
    self.name="main"
         }
    
    </SCRIPT>
    </HEAD>
    <BODY>
    
    <BUTTON ID="oSource" onClick="openindex()">Search WebConnectDM for CENTURY</BUTTON><br>
    
    </BODY>
    </html>
    For some reason, at my home, and work, using IE, the child window won't run it's S2CB function without refreshing the child window.. any ideas??

    What's odd, is at another location, it instead shows one of those "possible nefarious script" yellow bar that you have to click to clear, then it works without a refresh.. but everywhere else a refresh is needed.. I'm stumped.

  2. #2
    SitePoint Enthusiast Tygatur's Avatar
    Join Date
    Apr 2006
    Location
    Germany
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hm, the function S2CB() is started through the eventhandler onload in the <body> Tag.
    onload only triggers when the document is loaded. And any document created by document.write is NEVER fully loaded. (maybe document.close() will work, try it out)
    How should the browser know that this is last document.write() ? If you look at the process bars of the browsers they are always loading, because there is no definite end of the document.
    to code or not to code ?
    that's too much of a question for a signature.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •