5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:
性别:秘密
最后登录:2012-09-14
http://gmail.5d.cn/
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/06/14 | 有用的JS代码
类别(让工作更简单)
|
评论
(2)
|
阅读(262)
|
发表于 22:45
<SCRIPT>
var g_sClickPrefix = "WM3-en-us/20/20";
var g_sData = "blank";
var g_sClickUrl = "http://windowsmedia.com/Mediaguide/ClickTracking/Click.htm?WMPFriendly=true";
var g_fInPlayer = false;
var g_fInCorona = false;
var g_sUrlPrefix = "http://windowsmedia.com";
var g_sRedirUrl = "http://redir.windowsmedia.com/";
var g_sPageId = "20";
var g_sPagePath = "/Mediaguide/Templates/Template1.aspx";
var g_sAppPath = "/Mediaguide";
var g_sPlayerVersion = "";
var g_sPartner = "";
</SCRIPT> <SCRIPT language=javascript>
function HelpArray(len)
{this.length=len;}
HelpText = new HelpArray(3);
HelpText[0] ='';
HelpText[1] ='';
HelpText[2] ='';
ScriptText = new HelpArray(3);HelpText2 = new HelpArray2(3);
HelpText2[0] ="<img border='0' width='480' height='160' src='http://www.blueidea.com/gg/midoidea/11.gif'>";
HelpText2[1] ="<img border='0' width='480' height='160' src='http://www.chinaui.com/images/banner/1.gif'>";
HelpText2[2] ="<img border='0' width='480' height='160' src='http://www.chinaui.com/images/banner/4.jpg'>";
ScriptText2 = new HelpArray2(3);
var i = 0;
function playHelp(){
if (i == 2)
{i = 0;}
else
{i++;}
div1.filters[0].apply(); div1.innerHTML = HelpText[i]; div1.filters[0].play(); div2.filters[0].apply(); div2.innerHTML = HelpText2[i]; div2.filters[0].play(); mytimeout = setTimeout('playHelp()',6000);}function HelpArray(len) { this.length=len;}function HelpArray2(len) {this.length=len;}</SCRIPT>
<SPAN style="WIDTH: 480px; HEIGHT: 160px"><SPAN
style="PADDING-LEFT: 20px; Z-INDEX: 1; WIDTH: 480px; POSITION: absolute; HEIGHT: 160px; left: 192px; top: 263px;">
<TABLE
style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 0px"
cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><BR> <BR> <BR> <BR> <BR> <SCRIPT>var mytimeout;</SCRIPT>
</TD>
</TR>
<TR>
<TD vAlign=top width=260 height=12><SPAN id=div1
style="PADDING-LEFT: 2px; FILTER: progid:DXImageTransform.Microsoft.Fade(duration=1,overlap=0); POSITION: absolute"></SPAN></TD>
</TR>
</TBODY>
</TABLE>
</SPAN><SPAN
id=div2
style="FILTER: progid:DXImageTransform.Microsoft.Wipe(duration=3, gradientsize=0.25,motion=reverse ); WIDTH: 480px; POSITION: absolute; HEIGHT: 160px"><IMG
height=160
src="http://www.blueidea.com/gg/midoidea/11.gif"
width=480
onload='mytimeout = setTimeout("playHelp()",3000);'
border=0>
<DIV></DIV>
</SPAN></SPAN>
第2种效果
<SCRIPT LANGUAGE="javascript" defer>
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 2000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = "http://www.blueidea.com/bbs/icon/icon1.gif";
Pic[1] = "http://www.blueidea.com/bbs/icon/icon2.gif";
Pic[2] = "http://www.blueidea.com/bbs/icon/icon3.gif";
Pic[3] = "http://www.blueidea.com/bbs/icon/icon4.gif";
Pic[4] = "http://www.blueidea.com/bbs/icon/icon5.gif";
// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
</script>
<body onload="runSlideShow()">
<img id="SlideShow"/>
表格复选、复选变色、以及行的间隔行
<style type="text/css">
<!--
.row {BACKGROUND-COLOR: expression(rowIndex%2==1?'':'#F5F5F5')}
Body {FONT-SIZE: 12px; FONT-FAMILY: Arial,Verdana,sans-serif;LINE-HEIGHT: 150%;}
Td {FONT-SIZE: 12px; FONT-FAMILY: Arial,Verdana,sans-serif;LINE-HEIGHT: 150%;}
.tb {border-collapse: collapse}
-->
</style>
<script language="javascript" type="text/javascript">
//复选
function selectAll(chk)
{
var chk = document.form1.chkAll.checked;
for (i=0;i<document.all.length;i++) {
if (document.all[i].name=="id[]") {
document.all[i].checked=chk;
chkRow(document.all[i]);
}}}
//复选后单元格变色
function chkRow(obj){
var r = obj.parentElement.parentElement;
if(obj.checked){ r.style.backgroundColor="#E6E9F2";}
else {if(r.rowIndex%2==1)r.style.backgroundColor="";else r.style.backgroundColor="#F5F5F5";}
}
</script>
<table width="50%" border="1" cellpadding="3" cellspacing="0" bordercolor="#333333" class="tb">
<form name="form1" method="post" action="">
<tr class="row">
<td width="5%"> </td>
<td width="33%" align="center"><strong>论坛名称</strong></td>
<td width="62%" align="center"><strong>网 址</strong></td>
</tr>
<tr class="row">
<td align="center"><input type="checkbox" name="id[]" value="1" onclick="javascript:chkRow(this);"></td>
<td align="center">织梦乱弹</td>
<td align="center"><a href="http://www.it365cn.com/bbs" target="_blank">http://www.it365cn.com/bbs</a></td>
</tr>
<tr class="row">
<td align="center"><input type="checkbox" name="id[]" value="1" onclick="javascript:chkRow(this);"></td>
<td align="center">经典论坛</td>
<td align="center"><a href="http://www.blueidea.com/bbs" target="_blank">http://www.blueidea.com/bbs</a></td>
</tr>
<tr class="row">
<td align="center"><input type="checkbox" name="id[]" value="1" onclick="javascript:chkRow(this);"></td>
<td align="center">点燃灵感</td>
<td align="center"><a href="http://www.fwcn.com/bbs" target="_blank">http://www.fwcn.com/bbs</a></td>
</tr>
<tr class="row">
<td colspan="3"><input type="checkbox" name="chkAll" title="全选/取消" onclick="selectAll()"> <strong>全选/取消</strong></td>
</tr>
</form>
</table>
右下角的提示效果
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="51windows.Net">
<META NAME="Author" CONTENT="haiwa">
<title>类似MSN提示的页面效果</title>
</head>
<body scroll=no>
看到右下角的提示了吗?如果没有看到,<button onclick=location.reload();>刷新</button>一下
<script language="javascript">
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("eMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}
function resizeDiv()
{
i+=1
if(i>500) closeDiv()
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}
function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
</script>
<DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
<TBODY>
<TR>
<TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #0f2c8c" width=30 height=24></TD>
<TD style="FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #1f336b; PADDING-TOP: 4px;PADDING-left: 4px" vAlign=center width="100%"> 短消息提示:</TD>
<TD style="BACKGROUND-IMAGE: url(msgTopBg.gif); PADDING-TOP: 2px;PADDING-right:2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:red;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span><!-- <IMG title=关闭 style="CURSOR: hand" onclick=closeDiv() hspace=3 src="msgClose.jpg"> --></TD>
</TR>
<TR>
<TD style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: url(1msgBottomBg.jpg); PADDING-BOTTOM: 1px" colSpan=3 height=90>
<DIV style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">您有<font color=#FF0000>1</font>封新短消息<BR><BR>
<DIV align=center style="word-break:break-all"><a href="javascript:alert('你好')"><font color=#FF0000>点击查看短信</font></a></DIV
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</body>
</html>
不一样的MENU RIGHT
html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>cnbruce</title>
<style type="text/css"><!--
.p9 {font-size: 12px; line-height: 120%;}
.title {font-size: 25px;}
.div1 { border-top:buttonface 1px solid;border-left:buttonface 1px solid;border-bottom:windowframe 1px solid;border-right:windowframe 1px solid;}
.div2 { border-top:window 1px solid;border-left:window 1px solid;border-bottom:buttonshadow 1px solid;border-right:buttonshadow 1px solid;}
.Mover {background-color:highlight;color:highlighttext;font-size: 12px;cursor:default;font-size: 12px;}
.Mout {background-color:buttonface;color:buttontext;font-size: 12px;cursor:default;font-size: 12px;}
td {font-size: 14.9px; line-height: 1.3}
select {font-size: 14.9px;}
body {font-size: 14.9px; line-height: 1.3}
A {text-decoration: none;}
A:hover {color: #FF0000; text-decoration: underline;}
--></style>
<script language="javascript">
function RegFun(JsName){if(parent==this) document.write("<"+"script src=\"fun/"+JsName+".js\"><"+"/script>");else if(eval("parent."+JsName)) document.write("<"+"script>"+eval("parent."+JsName)+"<"+"/script>");else{document.write("<"+"script src=\"fun/"+JsName+".js\"><"+"/script>");AutoRegStr+="parent."+JsName+"="+JsName+".toString();"}}
var AutoRegStr="";
</script>
<script language="javascript">
RegFun("ShowMouseMenu");
RegFun("DrawMouseMenu");
</script>
<script language="javascript">
var intDelay=20;
var intInterval=5;
function GradientShow()
{MouseMenu.filters.alpha.opacity+=intInterval;
if (MouseMenu.filters.alpha.opacity<100) setTimeout("GradientShow()",intDelay);}
function ShowMouseMenu(){
if(MouseMenu.style.visibility=='visible')MouseMenu.style.visibility='hidden';MouseMenu.filters.alpha.opacity=0;
if(event.srcElement.tagName=="IMG"&&event.srcElement.id!="menugif"||event.srcElement.tagName=="A"||event.srcElement.tagName=="TEXTAREA"||event.srcElement.tagName=="INPUT"||oSelection.type!="None")
return true;
else{
if(event.clientX+150 > document.body.clientWidth)MouseMenu.style.left=event.clientX+document.body.scrollLeft-150;
else MouseMenu.style.left=event.clientX+document.body.scrollLeft;
if(event.clientY+DivH > document.body.clientHeight)MouseMenu.style.top=event.clientY+document.body.scrollTop-DivH;
else MouseMenu.style.top=event.clientY+document.body.scrollTop;
MouseMenu.style.visibility='visible';
GradientShow();
}
return false;
}
</script>
<script language="javascript">
function DrawMouseMenu(){
DivH=2;
oSelection = document.selection;
var HrStr="<tr><td align=center valign=middle height=2><TABLE border=0 cellpadding=0 cellspacing=0 width=128 height=2><tr><td height=1 bgcolor=buttonshadow><\/td><\/tr><tr><td height=1 bgcolor=buttonhighlight><\/td><\/tr><\/TABLE><\/td><\/tr>";
var MenuStr1="<tr><td align=center valign=middle height=20><TABLE border=0 cellpadding=0 cellspacing=0 width=132><tr><td valign=middle height=16 class=Mout onMouseOver=this.className='Mover'; onMouseOut=this.className='Mout'; onclick=\"";
var MenuStr2="<\/td><\/tr><\/TABLE><\/td><\/tr>";
var XiciMenu=["window.history.back()\">后退","window.history.forward()\">前进"];
var SysMenu=["document.execCommand('SelectAll')\">全选","MouseMenu.style.visibility='hidden';document.execCommand('SaveAs','true')\">另存为…","location.replace('view-source:'+location.href)\">查看源文件","window.print()\">打印","window.location.reload()\">刷新"];
var MenuStr="";
for(i=0;i<XiciMenu.length;i++){
MenuStr+=MenuStr1+XiciMenu[i]+MenuStr2;
DivH+=20;
}
MenuStr+=HrStr;
for(i=0;i<arguments.length;i++){
MenuStr+=MenuStr1+arguments[i]+MenuStr2;
DivH+=20;
}
if(arguments.length>0){
MenuStr+=HrStr;
DivH+=2;
}
for(i=0;i<SysMenu.length;i++){
MenuStr+=MenuStr1+SysMenu[i]+MenuStr2;
DivH+=20;
}
var DivStr1="<DIV id=MouseMenu class=div1 style=\"position:absolute; left:0px; top:0px; width=150;height="+DivH+"; z-index:1; filter:alpha(opacity=0)\"><TABLE border=0 cellpadding=0 cellspacing=0 class=div2><tr><td width=10 valign=bottom align=center bgcolor=buttonface> C N B R U C E <img src='/images/icon/14.gif'> <\/td><td bgcolor=buttonface><TABLE border=0 cellpadding=0 cellspacing=0>";
var DivStr2="<\/TABLE><\/td><\/tr><\/TABLE><\/DIV>";
document.write(DivStr1+MenuStr+DivStr2);
document.body.oncontextmenu=new Function("return ShowMouseMenu();");
document.body.onclick=new Function("MouseMenu.style.visibility='hidden';");
document.body.onscroll=new Function("MouseMenu.style.visibility='hidden';");
document.body.onselectstart=new Function("MouseMenu.style.visibility='hidden';");
window.onresizestart=new Function("MouseMenu.style.visibility='hidden';");
}
</script>
</head>
<body>
<script language="javascript">
DrawMouseMenu();
</script>
www.cnbruce.com
</body>
</html>
图片切换效果
有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>
<!-- 把如下代码加入<body>区域中 -->
<!--
www.webjx.com/js
-->
<!-- bbs
www.webjx.com/bbs-->
;
<script language=javascript>
<!-- // BannerAD
var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=0;
bannerAD[0]="/img/200406301.jpg";
bannerADlink[0]="/js";
bannerAD[1]="/img/200406302.jpg";
bannerADlink[1]="/js";
bannerAD[2]="/img/200406303.jpg";
bannerADlink[2]="/js";
bannerAD[3]="/img/200406304.jpg";
bannerADlink[3]="/js";
bannerAD[4]="/img/200406305.jpg";
bannerADlink[4]="/js";
var preloadedimages=new Array();
for (i=1;i<bannerAD.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=bannerAD[i];
}
function setTransition(){
if (document.all){
bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
bannerADrotator.filters.revealTrans.apply();
}
}
function playTransition(){
if (document.all)
bannerADrotator.filters.revealTrans.play()
}
function nextAd(){
if(adNum<bannerAD.length-1)adNum++ ;
else adNum=0;
setTransition();
document.images.bannerADrotator.src=bannerAD[adNum];
playTransition();
theTimer=setTimeout("nextAd()", 100);
}
function jump2url(){
jumpUrl=bannerADlink[adNum];
jumpTarget='_blank';
if (jumpUrl != ''){
if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
function displayStatusMsg() {
status=bannerADlink[adNum];
document.returnvalue = true;
}
//-->
</script>
<table border="0" cellspacing="6" cellpadding="1">
<tr>
<td bgcolor="#FFFFFF"><A onmouseover="displayStatusMsg();return document.returnvalue" href="javascript:jump2url()"><IMG style="FILTER: revealTrans(duration=2,transition=20)" height=200 src="/img/200306301.jpg" width=150 border=0 name=bannerADrotator></A>
<SCRIPT language=javascript>nextAd()</SCRIPT></td>
</tr>
</table>
0
评论
Comments
日志分类
首页
[609]
网络工程师
[97]
系统分析师
[2]
让工作更简单
[214]
生活就是这样
[40]
正在流行ing
[132]
装修全记录
[1]
电影评论
[55]
网站推荐
[56]
资源推荐
[6]
PHP CMS
[6]