建议将代语句中的

(2)在新窗口中写如我想要的代码。new_win.document.write("")
(3)打印新窗口的内容。new_win.print()”
中的“new_win”换为“window”试试。

解决方案 »

  1.   

    建议将代语句中的

    (2)在新窗口中写如我想要的代码。new_win.document.write("")
    (3)打印新窗口的内容。new_win.print()”
    中的“new_win”换为“window”试试。
      

  2.   

    new_win.focus();
    new_win.print();
      

  3.   

    new_win.focus();
    new_win.print();
      

  4.   

    seabell(百合心) :不成!我试过了!!
      

  5.   

    我知道了,document.write之后就打不了了
    可以用innerHTML来变通,测试通过
    <script>
    function win_open()
    {
    var new_win=window.open("test.htm","","");
    setTimeout(mywait(),100000);
    new_win.document.body.innerHTML="<p>ballack<p>hero";
    new_win.focus();
    new_win.print();
    }
    function mywait()
    {}
    </script>
    <input type="button" name="print" value="打印预览" onCLick="win_open()">
      

  6.   

    我知道了,document.write之后就打不了了
    可以用innerHTML来变通,测试通过
    <script>
    function win_open()
    {
    var new_win=window.open("test.htm","","");
    setTimeout(mywait(),100000);
    new_win.document.body.innerHTML="<p>ballack<p>hero";
    new_win.focus();
    new_win.print();
    }
    function mywait()
    {}
    </script>
    <input type="button" name="print" value="打印预览" onCLick="win_open()">
      

  7.   

    OK!谢谢!
    但我还想知道innerHTML是做什么用的?请不吝赐教!
      

  8.   

    sorry我周末不在线
    innerHTML是一对标签中的html内容,比如
    <div id=mydiv><p>ballack<input type=button></div>,alert(mydiv.innerHTML),得到的结果是<p>ballack<input type=button>
    明白了吗