如何才能在我打开的窗口中设置好背景图片呢?
试了好久没有用,
代码如下:
OpenWindow=window.open("", "newwin", "height=100, width=400,toolbar=no,scrollbars='+scroll+',menubar=no,top=500,left=400"); //写成一行 
OpenWindow.document.write("<html>");
OpenWindow.document.write("<head>");
OpenWindow.document.write("<TITLE>例子</TITLE>");
OpenWindow.document.write("</head>");
OpenWindow.document.write("<BODY style='BACKGROUND-IMAGE: url(file:///C:\Inetpub\wwwroot\javajpg\背景screenchoice.jpg)'><form name='form2'>");
OpenWindow.document.write("<br>");
结果这样设置没有反应?请大家指点一下. OpenWindow.document.write("<input type='radio' name='channel' value='1' >");
OpenWindow.document.write("<input type='radio' name='channel' value='2' >");
OpenWindow.document.write("<input type='radio' name='channel' value='4' >");
OpenWindow.document.write("<input type='radio' name='channel' value='8' >");
OpenWindow.document.write("<br>");
OpenWindow.document.write("<input type='button' name='confirm' value='confirm' onclick='opener.covertnumber()'>");
OpenWindow.document.write("<input type='button' name='cancel' value='cancel' onclick='window.close()'>");
OpenWindow.document.write("</form2></BODY>");
OpenWindow.document.write("</HTML>");
OpenWindow.document.close();

解决方案 »

  1.   

    OpenWindow.document.write("<BODY style='BACKGROUND-IMAGE: url=/javajpg/背景screenchoice.jpg'><form name='form2'>");试试看。
      

  2.   

    OpenWindow.document.write("<BODY style='BACKGROUND-IMAGE: url(file:///C:\Inetpub\wwwroot\javajpg\背景screenchoice.jpg)'><form name='form2'>");
    这里的路径不能是“绝对路径”呀!
      

  3.   

    但是可以是自己从另一个网页连过来的
    OpenWindow.document.write("<BODY style='BACKGROUND-IMAGE: url(http://myHost/背景screenchoice.jpg)'><form name='form2'>");
      

  4.   

    file:///C:\Inetpub\\wwwroot\\javajpg\\背景screenchoice.jpg记得把document.write里所有的特殊 \ 换成 \\