菜鸟刚学javascript,求教script标签引用位置问题
JScript code
<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.scroll_top{
background-image:url(../images/dd_scroll_top.gif);
width:540px;
height:51px;
background-repeat:no-repeat;
}
.scroll_mid{
background-color:#f2f2f3;
border-left:solid 1px #d6d5d6;
border-right:solid 1px #d6d5d6;
width:533px;
padding:5px 0px 5px 5px;
}
#dd_scroll{ /*FF*/
float:none;
}
*html #dd_scroll{
float:left; /*IE6*/
}
*+html #dd_scroll{
float:left; /*IE7*/
}
#scroll_number{
float:right;
padding-right:10px;
}
#scroll_number li{
width:13px;
height:15px;
text-align:center;
border:solid 1px #999;
margin-top:5px;
font-size:12px;
line-height:16px;
cursor:pointer;
}
#right{
top:50px;
right:30px;
position:absolute;
z-index:4;
text-align:right;
cursor:pointer;
}
.dd_close{
width:35px;
height:18px;
text-align:center;
border:solid 1px #999;
background-color:#E0E0E0;
position:absolute;
right:0px;
float:right;
z-index:5;
}
/*通栏广告样式*/
.dd_index_top_adver{
margin:5px 0px 5px 0px;
clear:both;
}
</style>
<!--!!!第二个script标签开始-->
<script type="text/javascript">
var NowFrame=1;
var path= new Array();
path[0]="显示图片11111111111111111111111";
path[1]="显示图片22222222222222222222222222";
path[2]="显示图片333333333333333333333";
path[3]="显示图片44444444444444444444444444";
path[4]="显示图片555555555555555555555";
path[5]="显示图片666666666666666666666";
function show(id){
if(Number(id)){
//clearTimeout(theTimer);
NowFrame=parseInt(id) -1;
}
for(var i =0;i< path.length ;i++){
if(i==NowFrame){
document.getElementById("dd_scroll").innerHTML=path[i];
document.getElementById("dd_scroll"+(i+1)).className="scroll_number_over"; //设置当前标题的CSS样式(外部样式表)
}else{
document.getElementById("dd_scroll"+(i+1)).className="scroll_number_out";
}
}
if(NowFrame == path.length-1){ //设置下一个显示的图片
NowFrame = 0;
}else{
NowFrame++;
}
}
var theTimer=setInterval('show()', 3000); //设置定时器,显示下一张图片
window.onload=show; //页面加载时运行函数show()
</script> <!--第二个script标签结束-->
<!--!!!!第一个script标签开始-->
<script type="text/javascript">
var adv;
var top;
var left;
function dd_close(){
document.getElementById("right").style.display="none";
}
function inix(){
adv=document.getElementById("right");
if(adv.currentStyle){
top=parseInt(adv.currentStyle.top);
left=parseInt(adv.currentStyle.left);
}else{
top=parseInt(document.defaultView.getComputedStyle(adv,null).top);
left=parseInt(document.defaultView.getComputedStyle(adv,null).left);
}
}
function move(){
adv.style.top=top+parseInt(document.documentElement.scrollTop)+"px";
adv.style.left=left+parseInt(document.documentElement.scrollLeft)+"px";
}
window.onload=inix;
window.onscroll=move;
</script> <!--第一个script标签结束-->
</head>
<body>
<div id="right"><div class="dd_close"><a onClick="dd_close()">关闭</a></div>这里是浮动广告<br />这里是浮动广告<br />这里是浮动广告</div>
<div class="scroll_mid"><img src="images/dd_scroll_1.jpg" alt="轮换显示的图片广告" id="dd_scroll"/>
<div id="scroll_number">
<ul>
<li onMouseOver="show(1)" id="dd_scroll1" class="scroll_number_over">1</li>
<li onMouseOver="show(2)" id="dd_scroll2">2</li>
<li onMouseOver="show(3)" id="dd_scroll3">3</li>
<li onMouseOver="show(4)" id="dd_scroll4">4</li>
<li onMouseOver="show(5)" id="dd_scroll5">5</li>
<li onMouseOver="show(6)" id="dd_scroll6">6</li>
</ul>
</div>
</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</body>
</html>