在innerHtml中的CSS HACK不起作用了
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!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>
.text{
width:80px;
height:15px;
border:1px #30befa solid;
}
</style>
<script type="text/javascript">
function isIE(){ //ie?
if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1)
return true;
else
return false;
}
if(!isIE()){ //firefox innerText define
HTMLElement.prototype.__defineGetter__( "innerText",
function(){
return this.textContent.replace(/(^\s*)|(\s*$)/g, "");
}
);
HTMLElement.prototype.__defineSetter__( "innerText",
function(sText){
this.textContent=sText;
}
);
}
window.attachEvent('onload',isIE);
function chag()
{
var c=document.getElementById("hk");
var k=c.innerText;
var y=document.getElementById("ti");
c.innerHTML="<input id=\"textn\" class=\"text\" type=\"text\" value=\""+k+"\" />";
y.innerHTML="<button style=\"border:3px solid red; *border:3px solid pink; _border:3px solid blue;\"
onclick=\"javascript:comi();\">确定</button> <button onclick=\"javascript:huan();\">取消</button>";
}
function huan()
{ var h=document.getElementById("hk");
var c=document.getElementById("textn");
var k=c.value;
var y=document.getElementById("ti");
h.innerHTML=k;
y.innerHTML="<a href=\"#\" onclick=\"javascript:chag();\" ><span id=\"dt\"
style=\"display:none;width:50px;\">XXM</span></a>";
}
function show()
{
document.getElementById("dt").style.display="block";
}
function comi()
{
document.ju.submit();
}
</script>
</head>
<body>
<form name="ju" method="post" action="http://www.sina.com">
<div style="float:left;clear:right;"><a href="#" id="hk" onmousemove="javascript:show();" >选购指南</a></div>
</form>
<div id="ti" style="float:left;clear:right;margin-left:10px;"><a href="#" onclick="javascript:chag();" ><span id="dt"
style="display:none;width:50px;">XXM</span></a></div>
</body>
</html>
以上是代码,火狐下确定按钮的边框是3像素的红色,IE6下应该是蓝色,IE7下应该是粉色,火狐下正常,IE6和IE7下竟然失效,CSS HACK没有写错,但不知道问题出在哪里?请高手帮忙解答,谢谢! 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
.text{
width:80px;
height:15px;
border:1px #30befa solid;
}
</style>
<script type="text/javascript">
function isIE(){ //ie?
if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1)
return true;
else
return false;
}
if(!isIE()){ //firefox innerText define
HTMLElement.prototype.__defineGetter__( "innerText",
function(){
return this.textContent.replace(/(^\s*)|(\s*$)/g, "");
}
);
HTMLElement.prototype.__defineSetter__( "innerText",
function(sText){
this.textContent=sText;
}
);
}
window.attachEvent('onload',isIE);
function chag()
{
var c=document.getElementById("hk");
var k=c.innerText;
var y=document.getElementById("ti");
c.innerHTML="<input id=\"textn\" class=\"text\" type=\"text\" value=\""+k+"\" />";
y.innerHTML="<button style=\"border:3px solid red; *border:3px solid pink; _border:3px solid blue;\"
onclick=\"javascript:comi();\">确定</button> <button onclick=\"javascript:huan();\">取消</button>";
}
function huan()
{ var h=document.getElementById("hk");
var c=document.getElementById("textn");
var k=c.value;
var y=document.getElementById("ti");
h.innerHTML=k;
y.innerHTML="<a href=\"#\" onclick=\"javascript:chag();\" ><span id=\"dt\"
style=\"display:none;width:50px;\">XXM</span></a>";
}
function show()
{
document.getElementById("dt").style.display="block";
}
function comi()
{
document.ju.submit();
}
</script>
</head>
<body>
<form name="ju" method="post" action="http://www.sina.com">
<div style="float:left;clear:right;"><a href="#" id="hk" onmousemove="javascript:show();" >选购指南</a></div>
</form>
<div id="ti" style="float:left;clear:right;margin-left:10px;"><a href="#" onclick="javascript:chag();" ><span id="dt"
style="display:none;width:50px;">XXM</span></a></div>
</body>
</html>
以上是代码,火狐下确定按钮的边框是3像素的红色,IE6下应该是蓝色,IE7下应该是粉色,火狐下正常,IE6和IE7下竟然失效,CSS HACK没有写错,但不知道问题出在哪里?请高手帮忙解答,谢谢! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询