【公告】论坛无法登陆....解决通知:会员注册注意事项(2024.4.2 更新)[公告] 论坛升级中,会员有不明之处看过来...
返回列表 发帖

《心爱美文集粹》中的两个代码

对代码不是很懂,只是做了很简单的修改。

这个是浮动目录的代码,用浮动qq改的,在改的过程中还得到孤星老大的指点,也在这里谢过。
<DIV id=divStay style="POSITION: absolute">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width="7%"> </TD></TR></TBODY></TABLE></DIV>
<SCRIPT language=javascript>
function picsize(obj,MaxWidth){
img=new Image();
img.src=obj.src;
if (img.width>MaxWidth)
{
return MaxWidth;
}
else
{
return img.width;
}
}
function CloseQQ()
{
divStayTopleft.style.display="none";
return true;
}
var online= new Array();
</SCRIPT>
<div id="divStayTopleft" style="POSITION: absolute">
<table cellspacing="0" cellpadding="0" width="109" border="0">
<tr>
<td colspan="3">
<a onClick="CloseQQ()" href="javascript:;" shape="circle" coords="91,16,12"></a></td>
</tr>
<tr>
<td width="6">&nbsp;</td>
<td valign="top" width="96">
<table cellspacing="0" cellpadding="0" width="110" align="center" border="0">
<tr>
<td height="30">
<table cellspacing="0" cellpadding="0" width="110" border="0">
<tr>
<td height="30" width="110"><font size="+3" color="#FF0000"><a href="../作者言.html">作者言</a></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" cellpadding="2" id="table47">
<tr>
<td height="23" valign="bottom"><font size="+3" color="#FF0000"><a href="../目录1.html">目录1</a></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<table border="0" width="100%" cellpadding="2" id="table47">
<tr>
<td height="23" valign="bottom"><font size="+3" color="#FF0000"><a href="../目录2.html">目录2</a></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</td>
<td width="7">&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</div>
<script type="text/javascript">
function FloatTop()
{
var startX1 =document.body.offsetWidth-125 ,startY1 = 5;
var startX2 =0,startY2 = 95;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id,startX,startY)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.top=y;};
el.x = startX;
el.y = startY;
return el;
}
window.stayTopLeft=function()
{
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY1 - ftlObj.y)/8;
ftlObj1.y += (pY + startY2 - ftlObj1.y)/8;
ftlObj.sP(document.body.scrollLeft+document.body.offsetWidth-125, ftlObj.y);
ftlObj1.sP(ftlObj1.x, ftlObj1.y);
setTimeout("stayTopLeft()", 30);
}
// ftlObj = ml("divStay",document.body.scrollLeft+document.body.offsetWidth-125,0);
// ftlObj1 = ml("divStayTopLeft",0,30);
ftlObj = ml("divStay",(document.body.scrollLeft+document.body.offsetWidth)/2+379,0);
ftlObj1 = ml("divStayTopLeft",(document.body.scrollLeft+document.body.offsetWidth)/2+379,30);
stayTopLeft();
}
FloatTop();
</script>

这是是主页图片的特效,完全没有任何的改动。

<!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>

</head>

<body>
<script language="JavaScript">
//var d='true'
var d=0
function JM_fade(ob){

if (d==0) {ob.filters.alpha.opacity+=1} else {ob.filters.alpha.opacity-=1}

if (ob.filters.alpha.opacity==100){d=1;} else if (ob.filters.alpha.opacity==0){d=0}

}
setInterval("JM_fade(u)",10)

</script>

<table height="765" width="972" border="0" align="center">
<tr>
<td><a href="目录1.html"><img src="主页.jpg" width="972" height="765" alt="主页" name="u" style="filter:alpha(opacity=0)" /></a></td>
</tr>
</table>
</body>
</html>
多谢原作者。

呵呵,我一般喜欢套模版的,看到代码就晕了

思念的距离是大陆到香港,绝望的距离是人间到天堂。 友情提示:认真发贴,认真看贴,认真回帖,重塑心爱,从自我做起。

TOP

QUOTE:
以下是引用诹访湖衣在2008-3-11 21:01:23的发言:

呵呵,我一般喜欢套模版的,看到代码就晕了

代码玩起来还是很有意思滴,呵呵

TOP

返回列表