如上图所示,点击栏目分类 图片按钮无法弹出栏目分类的窗口供用户选择。
aspx文件代码
<asp:TextBox ID="ClassName" runat="server" MaxLength="100" Width="98" CssClass="form"></asp:TextBox> <asp:HiddenField runat="server" ID="ClassID" /> <label id="showClassTF" runat="server"><img src="../../sysImages/folder/s.gif" alt="选择栏目" border="0" style="cursor:pointer;" onclick="selectFile('newsclass',new Array(document.Form1.ClassID,document.Form1.ClassName),250,500);document.Form1.ClassName.focus();" /></label>——————————————————————————————————————————————————————
js文件响应事件代码:
function selectFile(type,obj,height,width)
{
var ShowObj = obj;
if(isArray(obj) && obj.length > 1)
ShowObj = obj[1];
showfDiv(ShowObj,"loading...",width);
LastSelectObj = obj;
var options={
method:'get',
parameters:"heights="+ height,
onComplete:function(transport)
{
var returnvalue=transport.responseText;
if (returnvalue.indexOf("??")>-1)
showfDiv(ShowObj,'Error',width);
else
var tempstr=returnvalue;
showfDiv(ShowObj,tempstr,width);
}
};
var arrtype=type.split("|")[0]
switch(arrtype)
{
case "file":
new Ajax.Request('../../configuration/system/iframe.aspx?FileType=file',options);
break;
case "newsclass":
new Ajax.Request('../../configuration/system/iframe.aspx?FileType=newsclass',options);
break; }
}js文件弹出窗口代码
———————————————————————————————————————————————————————
function showfDiv(obj,content,width){
var pos = getPosition(obj);
var objDiv = document.getElementById("s_id");
if (objDiv==null)
{
objDiv = document.createElement("div");
objDiv.id="s_id";
}
objDiv.className="selectStyle";
objDiv.style.position = "absolute";
var tempheight=pos.y;
var tempwidth1,tempheight1;
var windowwidth=document.body.clientWidth;
var isIE5 = (navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE")>0 && parseInt(navigator.appVersion)> 4);
var isIE55 = (navigator.appVersion.indexOf("MSIE 5.5")>0);
var isIE6 = (navigator.appVersion.indexOf("MSIE 6")>0);
var isIE7 = (navigator.appVersion.indexOf("MSIE 7")>0);
var isIE8 = (navigator.appVersion.indexOf("MSIE 8")>0);
var isIE9 = (navigator.appVersion.indexOf("MSIE 9")>0); if(isIE5||isIE55||isIE6||isIE7||isIE8||isIE9){var tempwidth=pos.x+305;}else{var tempwidth=pos.x+312;}
objDiv.style.width = width+"px";
objDiv.innerHTML = content;
if (tempwidth>windowwidth)
{
tempwidth1=tempwidth-windowwidth
objDiv.style.left = (pos.x-tempwidth1) + "px";
}
else
{
if(isIE5||isIE55||isIE6||isIE7||isIE8||isIE9){objDiv.style.left = (pos.x) + "px";}else{objDiv.style.left = (pos.x) + "px";}
}
if(isIE5||isIE55||isIE6||isIE7||isIE8||isIE9){objDiv.style.top = (pos.y+22) + "px";}else{objDiv.style.top = (pos.y+22) + "px";} objDiv.style.display = "";
document.ondblclick=function () { if(objDiv.style.display==""){objDiv.style.display="none";} }
document.body.appendChild(objDiv);
}
把安全降低就可以了.
SCRIPT5007: 无法获取属性“ClassID”的值: 对象为 null 或未定义可是我aspx文件里明明定义了“ClassID”
<asp:TextBox ID="ClassName" runat="server" MaxLength="100" Width="98" CssClass="form"></asp:TextBox> <asp:HiddenField runat="server" ID="ClassID" /> <label id="showClassTF" runat="server"><img src="../../sysImages/folder/s.gif" alt="选择栏目" border="0" style="cursor:pointer;" onclick="selectFile('newsclass',new Array(document.Form1.ClassID,document.Form1.ClassName),250,500);document.Form1.ClassName.focus();" /></label>
查看下源html 。
用以上语句查看html代码结果输出为 ClassID
请问该如何解决呢?