开发者

open a new window from another pop up javascript window

I'm trying to open a new window from another pop up java script window via writing html code in this pop up window, but it doesn't work, please help me as soon as possible.

 <html>
          <head>
          <style>
        .larger{ width:750px;}
        .standard{ width:600px;}
        .orginal{ width:10px;}
         </style>

            <script type="text/javascript">

            function  larger()
            {
      开发者_JAVA技巧      OpenWindow=window.open("", "larger","width=1000,scrollbars=yes"); 
            OpenWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'+
            'http://www.w3.org/TR/html4/strict.dtd">'+
            '<html><head><title>Test page</title>'+
            '<style type="text/css">'+
            '.larger{ width:750px;}'+
            '</style></head><body>');
            OpenWindow.document.write('<a  href="#" onclick="standard()">high</a>');
            OpenWindow.document.write("<img id='img1' src='webfonts.jpg'>");
            OpenWindow.document.write('</body></html>');
            OpenWindow.document.close();
            OpenWindow.document.getElementById("img1").className = "larger";

         }
             function  standard()
        {
        OpenWindow=window.open("", "newwin",'width=600,scrollbars=yes'); 
        OpenWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'+
            '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'+
            '<html><head><title>Test page</title>'+
            '<style type="text/css">'+
            '.standard{ width:600px;}'+
            '</style></head><body>');
        OpenWindow.document.write("<img id='img1' src='webfonts.jpg'>");
        OpenWindow.document.write('</body></html>');
        OpenWindow.document.close();
        OpenWindow.document.getElementById("img1").className = "standard";
         } 
        </script>
    </head>
    <body>
    <img  class="orginal"id="img1" src="webfonts.jpg" border="0" />
    <span   onclick="larger()"><a href="#">fig1</a></span>
    </body>
    </html>


You have created the standard function in the first parent script and you are trying to call it from the child pop-up window, which would offcourse not find this function defined within it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜