我的代码<script LANGUAGE="JavaScript"> 
<!-- 
function openwin() { 
window.open ("2.html", "newwindow", "height=100, width=400, toolbar=no, scrollbars=no, resizable=no, location=no, status=no") 
} (我写在一行了!!!!!)
//--> 
</script> 
调用代码:<input type="button" onclick="openwin()" value="打开窗口"> 
我想应该都不错吧?页面可以打开,可就是控制不了页面的大小,和工具栏什么的!为什么啊?浪费了我半天啦! 

解决方案 »

  1.   

    郁闷,工具栏没有是你自己关掉的,toolbar=no这句改成yes,resizable 这个参数是设置窗口是否可以调整大小,你也关了,改成yes就好。
      

  2.   

    <html>
      <head>
      <title>window.open函数 </title>
      </head>
      <body>
      <script language="javascript">
      <!--
    function test(){
      window.open ("page.html", "newwindow", "height=100, width=400, toolbar= no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");}
      //-->
      </script>
    <input type="button" value="test" onclick="test();"/>
      </body>
      </html> 
      

  3.   

    LZ是从其他地方copy的把
    window.open的第二个参数是控制打开窗口的属性
    toolbar=no 工具栏
    scrollbars=no 滚动条
    resizable=no 大小可调
    location=no 地址栏
    status=no 状态栏
    这些值都为no,说明都是不显示的直接window.open("2.html", "newwindow", "height=100, width=400");即可
      

  4.   

    能不能让窗口不弹出来,能设置成window.open("width=0,height=0")?我在做让页面的内容导入EXCEL上
    和大家分享一段代码,实现导入EXCEL的,但是有个页面弹出来,怎么不让弹出来呢?
    function getXlsFromTbl(inTblId, inWindow) {   
        try {   
            var allStr = "";   
            var curStr = "";   
           // alert("getXlsFromTbl");   
            if (inTblId != null && inTblId != "" && inTblId != "null") {   
                curStr = getTblData(inTblId, inWindow);   
            }   
      
            if (curStr != null) {   
                allStr += curStr;   
            }   
            else {   
                alert("你要导出的表不存在!");   
                return;   
            }   
      
            var fileName = getExcelFileName();   
            doFileExport(fileName, allStr);   
        }   
        catch(e) {   
            alert("导出发生异常:" + e.name + "->" + e.description + "!");   
        }   
    }   
      
    function getTblData(inTbl, inWindow) {   
        var rows = 0;   
       // alert("getTblData is " + inWindow);   
        var tblDocument = document;   
        if (!!inWindow && inWindow != "") {   
            if (!document.all(inWindow)) {   
                return null;   
            }   
            else {   
                tblDocument = eval(inWindow).document;   
            }   
        }   
      
        var curTbl = tblDocument.getElementById(inTbl);   
        var outStr = "";   
        if (curTbl != null) {   
            for (var j = 0; j < curTbl.rows.length-2; j++) {   
                //alert("j is " + j);   
                for (var i = 3; i < curTbl.rows[j].cells.length-3; i++) {   
                    //alert("i is " + i);   
                    if (i == 0 && rows > 0) {
                     //alert(outStr+"==");   
                        outStr += " \t";  
                        //alert(outStr+"--"); 
                        rows -= 1;   
                    }   
                    outStr += curTbl.rows[j].cells[i].innerText + "\t";   
                    //alert(outStr+"**"); 
                    if (curTbl.rows[j].cells[i].colSpan > 1) {   
                        for (var k = 0; k < curTbl.rows[j].cells[i].colSpan - 1; k++) {   
                            outStr += " \t";   
                        }   
                    }   
                    if (i == 0) {   
                        if (rows == 0 && curTbl.rows[j].cells[i].rowSpan > 1) {   
                            rows = curTbl.rows[j].cells[i].rowSpan - 1;   
                        }   
                    }   
                }   
                outStr += "\r\n";   
            }   
        }   
        else {   
            outStr = null;   
            alert(inTbl + "不存在!");   
        }   
        return outStr;   
    }   
      
    function getExcelFileName() {   
        var d = new Date();   
        var curYear = d.getYear();   
        var curMonth = "" + (d.getMonth() + 1);   
        var curDate = "" + d.getDate();   
        var curHour = "" + d.getHours();   
        var curMinute = "" + d.getMinutes();   
        var curSecond = "" + d.getSeconds();   
      
        if (curMonth.length == 1) {   
            curMonth = "0" + curMonth;   
        }   
        if (curDate.length == 1) {   
            curDate = "0" + curDate;   
        }   
        if (curHour.length == 1) {   
            curHour = "0" + curHour;   
        }   
        if (curMinute.length == 1) {   
            curMinute = "0" + curMinute;   
        }   
        if (curSecond.length == 1) {   
            curSecond = "0" + curSecond;   
        }   
        
        var fileName = "交易商列表" + "_" + curYear + curMonth + curDate + "_" + curHour+":" + curMinute +":"+ curSecond + ".csv";   
        //alert(fileName);   
        return fileName;   
    }   
        
    function doFileExport(inName, inStr) {   
       var xlsWin = null;   
        if (document.all("glbHideFrm")) {   
            xlsWin = glbHideFrm;   
        }   
        else {   
           xlsWin = window.open("width=1,height=1,resizable=yes");      }   
        xlsWin.document.write(inStr);   
        xlsWin.document.close(); 
        
        xlsWin.document.execCommand('Saveas', true, inName);     
        
      

  5.   

    直接window.open("2.html", "newwindow", "height=100, width=400");