代码非常简单,错误非常恶心。<HTML> 
<HEAD> 
<title> WebForm1 </title> 
<script language="javascript">
function btnObject_onclick(){ 
alert(document.dlgHelper.ChooseColorDlg()); 
}  
</script> 
</HEAD> 
<body>  
<OBJECT id="dlgHelper"   height="0px" width="0px" classid= "clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b"> 
</OBJECT>  
<input type="image" id="btnFontB" src="../images/btn/B_normal.gif" style="width:50px;height:18px;margin-top:2px;" onclick="return btnObject_onclick()"/>
</body> 
</HTML> 
上面是一个非常简单的颜色板选择器
用IE8访问本地的没有问题,把本地的html放到服务器上访问就出js错误
错误描述如下:
网页错误详细信息用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; CIBA; .NET4.0C)
时间戳: Wed, 9 Feb 2011 06:45:58 UTC
消息: 由于出现错误 8007ffff 而导致此项操作无法完成。
行: 7
字符: 15
代码: 0
URI: http://192.168.1.61/tm2/b.htm
谁知道为啥吗? 用IE7访问服务器上的就OK。。
万恶的浏览器!!!

解决方案 »

  1.   

    你用IE专有的代码,其他浏览器当然不支持。
    只要不是IE内核的浏览器都不支持。
      

  2.   


    1.我现在的情况是IE7支持,IE8本地支持,在服务器不支持,别的浏览器我还没有试。
    2.请问换成通用的写法怎么写能调出来系统颜色选择框?
      

  3.   

    下面的是兼容火狐的代码。
    网上一搜一大堆。。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>颜色选择器</title>
    <style type="text/css">
    body{
    text-align:center;
    }
    </style>
    </head>
    <body>
    <p>
    <script type="text/javascript" language="javascript">
    <!--
    var ColorHex=new Array('00','33','66','99','CC','FF')
    var SpColorHex=new Array('FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF')
    var current=null
    function initcolor(evt)
    {
    var colorTable=''
    for (i=0;i<2;i++)
    {
    for (j=0;j<6;j++)
    {
    colorTable=colorTable+'<tr height=15>'
    colorTable=colorTable+'<td width=15 style="background-color:#000000">'
    if (i==0){
    colorTable=colorTable+'<td width=15 style="cursor:pointer;background-color:#'+ColorHex[j]+ColorHex[j]+ColorHex[j]+'" onclick="doclick(this.style.backgroundColor)">'}
    else{
    colorTable=colorTable+'<td width=15 style="cursor:pointer;background-color:#'+SpColorHex[j]+'" onclick="doclick(this.style.backgroundColor)">'}
    colorTable=colorTable+'<td width=15 style="background-color:#000000">'
    for (k=0;k<3;k++)
    {
    for (l=0;l<6;l++)
    {
    colorTable=colorTable+'<td width=15 style="cursor:pointer;background-color:#'+ColorHex[k+i*3]+ColorHex[l]+ColorHex[j]+'" onclick="doclick(this.style.backgroundColor)">'
    }
    }
    }
    }
    colorTable='<table border="0" cellspacing="0" cellpadding="0" style="border:1px #000000 solid;border-bottom:none;border-collapse: collapse;width:337px;" bordercolor="000000">'
    +'<tr height=20><td colspan=21 bgcolor=#ffffff style="font:12px tahoma;padding-left:2px;">'
    +'<span style="float:left;color:#999999;">网上一搜一大堆的,还上csdn问?</span>'
    +'<span style="float:right;padding-right:3px;cursor:pointer;" onclick="colorclose()">×关闭</span>'
    +'</td></table>'
    +'<table border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="000000" style="cursor:pointer;">'
    +colorTable+'</table>';
    document.getElementById("colorpane").innerHTML=colorTable;
    var current_x = document.getElementById("inputcolor").offsetLeft;
    var current_y = document.getElementById("inputcolor").offsetTop;
    //alert(current_x + "-" + current_y)
    document.getElementById("colorpane").style.left = current_x + "px";
    document.getElementById("colorpane").style.top = current_y + "px";
    }
    function doclick(obj){
    alert(obj);
    }
    function colorclose(){
    document.getElementById("colorpane").style.display = "none";
    //alert("ok");
    }
    function coloropen(){
    document.getElementById("colorpane").style.display = "";
    }
    window.onload = initcolor;
    </script>
    </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p>
    <input type="button" value="颜色选择" onclick="coloropen(event)" id="inputcolor" />
    </p>
    <p> </p>
    <div id="colorpane" style="position:absolute;z-index:999;display:none;"></div>
    </body>
    </html>