网页的DOCTYPE HTML public 会导致页面的部分事…

2008-02-23 07:56:07来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

最近忙着做JS,在JS里头有用到鼠标的一些事件时,通常我都是把鼠标事件包含在一个JS文件中调用
<script type="text/javascript" src="js/sb_cd.js"></script>

在鼠标事件中若包含如下鼠标的特效,就会导致事件触发:js/sb_cd.js
// JavaScript Document

var sb_cd_a_Colour='fff000';
var sb_cd_b_Colour='00ff00';
var sb_cd_c_Colour='ff00ff';
var sb_cd_Size=120;

var sb_cd_YDummy=new Array(),sb_cd_XDummy=new Array(),sb_cd_xpos=0,sb_cd_ypos=0,sb_cd_ThisStep=0;sb_cd_step=0.6;
if (document.layers){
window.captureEvents(Event.MOUSEMOVE);
function sb_cd_nsMouse(evnt){
sb_cd_xpos = window.pageYOffset evnt.pageX 6;
sb_cd_ypos = window.pageYOffset evnt.pageY 16;
}
window.onMouseMove = sb_cd_nsMouse;
}
else if (document.all)
{
function sb_cd_ieMouse(){
sb_cd_xpos = document.body.scrollLeft event.x 6;
sb_cd_ypos = document.body.scrollTop event.y 16;
}
document.onmousemove = sb_cd_ieMouse;
}

function sb_cd_swirl(){
for (i = 0; i < 3; i )
{
sb_cd_YDummy[i]=sb_cd_ypos sb_cd_Size*Math.sin((1*Math.sin((sb_cd_ThisStep)/10)) i*2)*Math.sin((sb_cd_ThisStep)/4);
sb_cd_XDummy[i]=sb_cd_xpos sb_cd_Size*Math.cos((1*Math.sin((sb_cd_ThisStep)/10)) i*2)*Math.sin((sb_cd_ThisStep)/4);
}
sb_cd_ThisStep =sb_cd_step;
setTimeout('sb_cd_swirl()',10);
}

var sb_cd_amount=10;
if (document.layers){
for (i = 0; i < sb_cd_amount; i )
{
document.write('<layer name=sb_cd_nsa' i ' top=0 left=0 width=' i/2 ' height=' i/2 ' bgcolor=' sb_cd_a_Colour '></layer>');
document.write('<layer name=sb_cd_nsb' i ' top=0 left=0 width=' i/2 ' height=' i/2 ' bgcolor=' sb_cd_b_Colour '></layer>');
document.write('<layer name=sb_cd_nsc' i ' top=0 left=0 width=' i/2 ' height=' i/2 ' bgcolor=' sb_cd_c_Colour '></layer>');
}
}
else if (document.all){
document.write('<div id="sb_cd_ODiv" style="position:absolute;top:0px;left:0px">'
'<div id="sb_cd_IDiv" style="position:relative">');
for (i = 0; i < sb_cd_amount; i )
{
document.write('<div id=sb_cd_x style="position:absolute;top:0px;left:0px;width:' i/2 ';height:' i/2 ';background:' sb_cd_a_Colour ';font-size:' i/2 '"></div>');
document.write('<div id=sb_cd_y style="position:absolute;top:0px;left:0px;width:' i/2 ';height:' i/2 ';background:' sb_cd_b_Colour ';font-size:' i/2 '"></div>');
document.write('<div id=sb_cd_z style="position:absolute;top:0px;left:0px;width:' i/2 ';height:' i/2 ';background:' sb_cd_c_Colour ';font-size:' i/2 '"></div>');
}
document.write('</div></div>');
}
function sb_cd_prepos(){
var sb_cd_ntscp=document.layers;
var sb_cd_msie=document.all;
if (document.layers){
for (i = 0; i < sb_cd_amount; i )
{
if (i < sb_cd_amount-1)
{
sb_cd_ntscp['sb_cd_nsa' i].top=sb_cd_ntscp['sb_cd_nsa' (i 1)].top;sb_cd_ntscp['sb_cd_nsa' i].left=sb_cd_ntscp['sb_cd_nsa' (i 1)].left;
sb_cd_ntscp['sb_cd_nsb' i].top=sb_cd_ntscp['sb_cd_nsb' (i 1)].top;sb_cd_ntscp['sb_cd_nsb' i].left=sb_cd_ntscp['sb_cd_nsb' (i 1)].left;
sb_cd_ntscp['sb_cd_nsc' i].top=sb_cd_ntscp['sb_cd_nsc' (i 1)].top;sb_cd_ntscp['sb_cd_nsc' i].left=sb_cd_ntscp['sb_cd_nsc' (i 1)].left;
}
else
{
sb_cd_ntscp['sb_cd_nsa' i].top=sb_cd_YDummy[0];sb_cd_ntscp['sb_cd_nsa' i].left=sb_cd_XDummy[0];
sb_cd_ntscp['sb_cd_nsb' i].top=sb_cd_YDummy[1];sb_cd_ntscp['sb_cd_nsb' i].left=sb_cd_XDummy[1];
sb_cd_ntscp['sb_cd_nsc' i].top=sb_cd_YDummy[2];sb_cd_ntscp['sb_cd_nsc' i].left=sb_cd_XDummy[2];
}
}
}
else if (document.all){
for (i = 0; i < sb_cd_amount; i )
{
if (i < sb_cd_amount-1)
{
sb_cd_msie.sb_cd_x[i].style.top=sb_cd_msie.sb_cd_x[i 1].style.top;sb_cd_msie.sb_cd_x[i].style.left=sb_cd_msie.sb_cd_x[i 1].style.left;
sb_cd_msie.sb_cd_y[i].style.top=sb_cd_msie.sb_cd_y[i 1].style.top;sb_cd_msie.sb_cd_y[i].style.left=sb_cd_msie.sb_cd_y[i 1].style.left;
sb_cd_msie.sb_cd_z[i].style.top=sb_cd_msie.sb_cd_z[i 1].style.top;sb_cd_msie.sb_cd_z[i].style.left=sb_cd_msie.sb_cd_z[i 1].style.left;
}
else
{
sb_cd_msie.sb_cd_x[i].style.top=sb_cd_YDummy[0];sb_cd_msie.sb_cd_x[i].style.left=sb_cd_XDummy[0];
sb_cd_msie.sb_cd_y[i].style.top=sb_cd_YDummy[1];sb_cd_msie.sb_cd_y[i].style.left=sb_cd_XDummy[1];
sb_cd_msie.sb_cd_z[i].style.top=sb_cd_YDummy[2];sb_cd_msie.sb_cd_z[i].style.left=sb_cd_XDummy[2];
}
}
}
setTimeout("sb_cd_prepos()",10);
}
function sb_cd_Start(){
sb_cd_swirl(),sb_cd_prepos()
}
window.onload=sb_cd_Start;


其中页面的代码如下:
当打开DW时,通常会先有这样预先定义好的代码,先看看第一行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:javascript中取得下拉框的值太麻烦(下拉框联动)

下一篇:页面不刷新,提交表单