一个JS文件控制所有的浮窗

//自动检测是否加载jquery
(function(){
	if(typeof jQuery == 'undefined'){
		document.write('<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js\"><\/script>');
	}
})();

function openZoosUrl(str)
{
	//location.href="/zxqq/";
	
	var w = screen.width * 0.86;     //宽度
	var h = screen.height * 0.8;   //高度
	var l = (screen.width-w)/2; //离左边距离
	window.open("http://www.onestopweb.cn/zixun/?f=" + str,'新开googleWin1',"height="+h+", width="+w+", top=0, left="+l+",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=n o, status=no")
}

function goto_qq()
{
	location.href="http://www.onestopweb.cn/zxqq/";
	//window.open("/zxqq/");
}


//左侧 QQ
document.write('	<div id="qqBox" style="display: block;z-index: 2147483647; position: fixed !important; left: 10px; top: 50px;">	');
document.write('		<img src="http://www.onestopweb.cn/swt/swt_left.jpg" border="0" usemap="#qqBoxMap"  />	');
document.write('		<map name="qqBoxMap" id="qqBoxMap">	');
document.write('			<area shape="rect" coords="91,5,133,26" href="javascript:void(0)" onclick="qq_hide();return false;" />	');
document.write('			<area shape="rect" coords="18,277,118,303" href="javascript:void(0)" onclick="goto_qq();return false;" />	');
document.write('		</map>	');
document.write('	</div>	');


//右侧商务通
document.write('	<div id="swtBox" style="display: none;position:fixed; _position:absolute; top:50px; right:10px; _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight)); border:none; z-index:99999; cursor: pointer; ">	');
document.write('		<a href="javascript:void(0)" onclick="hide_swt()" style="display:block; _position:absolute; cursor:pointer;" >	');
document.write('			<img src="http://www.onestopweb.cn/swt/x.gif" border="0" />	');
document.write('		<a href="javascript:void(0)" onclick="openZoosUrl();return false;" rel="nofollow" target="_blank">	');
document.write('			<img src="http://www.onestopweb.cn/swt/YumDamMTR.gif" border="0" /></a>	');
document.write('	</div>	');


//中间部分的商务通
document.write('<div id="centerBox" style="display:block;">	');
document.write('	<div id="centerBox2" style="z-index: 2147483647; position: fixed !important; left: 50%; margin-left: -240px !important; top: 50%; margin-top: -210px !important;">	');
document.write('		<img src="http://www.onestopweb.cn/swt/zxswt.gif" width="419" height="340" border="0" usemap="#SwtMap" />	');
document.write('		<map name="SWTMap" id="SWTMap">	');
document.write('			<area shape="rect" coords="382,5,411,30" href="javascript:void(0)" onclick="hide_center();return false;">	');
document.write('			<area shape="rect" coords="2,1,419,307" href="javascript:void(0)" onclick="openZoosUrl(\'center_swt\');return false;">	');
document.write('			<area shape="rect" coords="191,308,419,342" href="javascript:void(0)" onclick="openZoosUrl(\'center_swt\');return false;">	');
document.write('			<area shape="rect" coords="92,310,188,338" href="javascript:void(0)" onclick="hide_center();return false;">	');
document.write('		</map>	');
document.write('	</div>	');
document.write('</div>	');


//隐藏左侧 QQ
function qq_hide()
{
	document.getElementById('qqBox').style.display = 'none';
}

//隐藏右侧 商务通
function hide_swt()
{
	document.getElementById('swtBox').style.display = 'none';
}

//隐藏中间部分 商务通
function hide_center()
{
	document.getElementById('centerBox').style.display = 'none';
	document.getElementById('swtBox').style.display = 'block';
}


//重新显示所有 广告
function show_swt()
{
	document.getElementById('qqBox').style.display = 'block';
	document.getElementById('swtBox').style.display = 'block';
	document.getElementById('centerBox').style.display = 'block';
}


//每个30秒执行一次
setInterval(show_swt,30000);


//这里可以放一些统计代码
document.writeln('<div style="display:none">');
document.writeln('');
document.writeln('</div>');

猜你喜欢

转载自onestopweb.iteye.com/blog/2239515