div全站变灰代码有点问题,求助

JavaScript08

div全站变灰代码有点问题,求助,第1张

<!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/htmlcharset=gb2312" />

<script>

function turnoff(obj){

document.getElementById(obj).style.display="none"

}

</script>

<script type="text/javascript" src="jquery-1.5.1.min.js"></script>

<style type="text/css">

.mydiv

{

text-align: centerfont-size: 9ptz-index: 99width:500pxheight:300pxleft: 50%top: 50%

margin-left: -250px !importantmargin-top: -150px !importantmargin-top: 0pxposition: fixed !important

position: absolute

_top: expression(eval(document.compatMode &&

document.compatMode=='CSS1Compat') ?

documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/

document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2)/*IE5 IE5.5*/

}

.bg

{

background-color: #000000

width: 100%

height: 100%

left: 0

top: 0

filter: alpha(opacity=50)

opacity: 0.5

z-index: 1

position: fixed !important/*FF IE7*/

position: absolute

_top: expression(eval(document.compatMode &&document.compatMode=='CSS1Compat') ?

documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/

document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2)/*IE5 IE5.5*/

}

</style>

<script language="javascript" type="text/javascript">

var Itemindex = 0

function showDiv() {

document.getElementById('popDiv').style.display = 'block'

document.getElementById('bg').style.display = 'block'

}

function closeDiv() {

document.getElementById('popDiv').style.display = 'none'

document.getElementById('bg').style.display = 'none'

}

window.onload=function(){showDiv()}

</script>

</head>

<body>

<div onclick="showDiv()" style="display:blockcursor:pointer">

div#showDiv

</div>

<div id="popDiv" class="mydiv" style="display: none">

<div id="Prompt">

<div id="Close"><a href="#" onclick="closeDiv()" style="display:blockcursor:pointer"><strong>返回</strong></a></div>

<div id="qian"></div>

<div class="zhuliutishi" id="text">div#zhuliutishi</div>

</div>

</div>

<div id="bg" class="bg" style="display: none">

</div>

</body>

</html>

你说的是ie的插件,肯定没有用的

ff下可以用遮罩。。或者js

<script src="grayscale.js" type="text/javascript"></script>

<script type="text/javascript">

window.onload=function(){ //网页变灰

grayscale(document.body)

}

</script>

grayscale.js,你网上搜一下吧

msg 为DIV id ;

text 为 你要抓取的id 比如 文本的等;

要自己做个事件触发此方法;

function refer(){

var textValue = document.getElementById("text")

if(textValue.value == ""){

document.getElementById("msg").style.display ="none"

}

else{

document.getElementById("msg").style.display =""

}

}