发些经典的代码....
1.MARQUEE还能这样用!!<html>
<head>
</head>
<body>
<marquee behavior="alternate" height="400" direction="up" scrollamount="3" scrolldelay="30" width="500" bgcolor="#3399FF">
<marquee behavior="alternate" height="50" direction="left" scrollamount="3" scrolldelay="30" width="100%">
<font style="font-size: 35px">MARQUEE</font>
</marquee>
</marquee>
</body>
</html>
<center>
<marquee direction="up" onmouseover=this.stop() onmouseout=this.start()
scrollamount=3 WIDTH=100% Height=200 STYLE="filter:wave(add=1, phase=1,
freq=2, strength=50);COLORTAG="#00FF00"><center><FONT color=#339900
size=4>好好学习,<br>天天向上!<b><center> </font>
</marquee>
骇客帝国
<table border=0 HEIGHT=20 border="0" cellspacing="0" cellpadding="0" STYLE="BGCOLOR:BLACK;COLOR:GREEN;"><tr STYLE="BGCOLOR:BLACK"><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=3>1<br>A<br>B<br>C<br>D<br>2<br>3<br>4<br>5<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=5>1<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>2<br>3<br>A<br>B<br>C<br>D<br>4<br>5<br>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=6>1<br>2<br>3<br>4<br>5<br>6<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=2>1<br>2<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=9>1<br>2<br>3<br>4<br>5<br>6<br>7<br>A<br>B<br>C<br>D<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=-1>1<br>2<br>3<br>4<br>5<br>6<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=5>1<br>A<br>B<br>C<br>D<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=7>1<br>2<br>3<br>4<br>5<br>6<br>7<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=4>1<br>2<br>3<br>4<br>5<br>6<br>A<br>B<br>C<br>D<br>7<br>8<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=1>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=8>1<br>2<br>3<br>A<br>B<br>C<br>D<br>4<br>5<br>6<br>7<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=3>1<br>2<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=5>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=6>1<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=2>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=9>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>9<br>0</marquee></td><td width=10 bgcolor="black"><marquee direction=down SCROLLAMOUNT=-1>A<br>B<br>C<br>D<br>E<br>F<br>1<br>2<br>3<br>4<br>5<br>6<br>7<br>G<BR>H<BR>I<BR>J<BR>K<BR>L<BR>M<BR>N<BR>8<br>9<br>0</marquee></td></tr></table> <style type="text/css">
ul#hovershow2{
list-style-type: none;
margin: 50px;
width:200px;
float: left;
display: inline;
clear: both;
}
ul#hovershow2 li{
float: left;
display: inline;
width:20px;
height: 20px;
margin: 2px;
}
ul#hovershow2 li a {
text-decoration: none;
display: block;
width:20px;
height:20px;
border:1px red solid;
background-color: White;
line-height: 20px;
font-size: 12px;
text-align: center;
}
ul#hovershow2 li a:hover{
position: absolute;
width:40px;
height: 40px;
line-height: 40px;
font-size: 32px;
z-index:100;
margin: -10px 0 0 -10px;
}
</style>
<ul id="hovershow2">
<li><a href="1#" title="test"><span>1</span></a></li>
<li><a href="2#" title="test"><span>2</span></a></li>
<li><a href="3#" title="test"><span>3</span></a></li>
<li><a href="4#" title="test"><span>4</span></a></li>
<li><a href="5#" title="test"><span>5</span></a></li>
<li><a href="6#" title="test"><span>6</span></a></li>
<li><a href="7#" title="test"><span>7</span></a></li>
</ul> ■打开■
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■另存为■
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■属性■
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■打印■
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■页面设置■
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■刷新■
<input type=button value=刷新 name=refresh onclick="window.location.reload()">
■导入收藏■
<input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,);>
■导出收藏■
<input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,);>
■加入收藏■
<INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹>
■整理收藏夹■
<INPUT name=Submit2 onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)" type=button value=整理收藏夹>
■查看源文件■
<INPUT name=Button onclick=window.location = "view-source:" + window.location.href type=button value=查看源文件>
■语言设置■
<INPUT name=Button onclick="window.external.ShowBrowserUI(LanguageDialog, null)" type=button value=语言设置>
■前进■
<INPUT name=Submit onclick=history.go(1) type=submit value=前进>
■后退■
<INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退>
颜色拾取器
<head><script>function colorpicker() {var sColor=dlgHelper.ChooseColorDlg();ColorVal=sColor.toString(16);colorvalue.value=(ColorVal.length==6)?"#"+ColorVal.toUpperCase():"#"+(new Array(6-ColorVal.length+1).join("0"))+ColorVal.toUpperCase();clipboardData.setData('text',colorvalue.value);colorvalue.selected();}</script></head><body><OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" WIDTH="0px" HEIGHT="0px"></OBJECT><input type="button" value="Color Picker" onclick="colorpicker()"><input type="text" name=colorvalue></body>
获取系统字体
<!--宝玉 2004-2-26
http://www.webuc.net
http://www.nwpubbs.net
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 获取当前系统字体和排版样式 </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getSystemFonts(){
var a=dlgHelper.fonts.count;
var fArray = new Array();
var oDropDown = document.all.fonts;
for (i = 1;i < dlgHelper.fonts.count;i++){
fArray = dlgHelper.fonts(i);
var aOptions = oDropDown.options;
var oOption = document.createElement("OPTION");
aOptions.add(oOption);
oOption.text = fArray;
oOption.Value = i;
}
}
function getBlockFormats(){
var a=dlgHelper.blockFormats.count;
var fArray = new Array();
var oDropDown = document.all.formats;
oDropDown.setAttribute("id","FormatList");
for (i = 1;i < dlgHelper.blockFormats.count;i++)
{
fArray = dlgHelper.blockFormats(i);
var aOptions = oDropDown.options;
var oOption = document.createElement("OPTION");
aOptions.add(oOption);
oOption.text = fArray;
oOption.Value = i;
}
}
//-->
</SCRIPT>
</HEAD>
<BODY onload="getSystemFonts();getBlockFormats()">
系统字体和排版样式 SystemFont and BlockFormats<BR>
<SELECT NAME="fonts" onchange="document.body.style.fontFamily = this.options.text">
</SELECT>
<SELECT NAME="formats" onchange="document.body.style.fontFamily = this.options.text">
</SELECT>
<OBJECT ID=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" WIDTH="0px" HEIGHT="0px"></OBJECT>
</BODY>
</HTML>
日历控件
<html>
<head>
<title>设置日期 ...</title>
<style type="text/css">
.body,td{font-family:"Arial";font-size:8pt;color:#000000;}
.TrOut{background:#dddddd;height:26;border:1 solid #999999;border-top-color:#f4f4f4;
border-left-color:#f4f4f4;}
.TdOver{background:#eeeeee;height:20;border:1 solid #ffffff;border-top-color:#9c9c9c;border-left-color:#9c9c9c;}
.TdOut{background:#eeeeee;height:20;border:1 solid #9c9c9c;border-top-color:#ffffff;border-left-color:#ffffff;}
</style>
</head>
<body scroll=no>
<script language="JScript">
/*********************************************************
迷你日历1.0版本
如果下列代码发现bug请联系 [email protected]
函数 TableFunction 提供以下方法和属性:
ƒ.GetDateStr()
返回指定年月的日期的数组,包括空字符.
参数:
y是指年
m是指月
调用方式:TableFunction().GetDateStr(Year,Month)
„.GetTableStr()
返回指定年月的已经格式化了的表格
参数:
y是指年
m是指月
调用方式:TableFunction().GetTableStr(Year,Month)
….WriteSelect()
返回年月的选择框
参数:
obj是指需要加入选择框的容器
values是指需要加亮的项目
action是指参数,带入参数y表示是年选择框,带入参数m表示月选择框
getobj是指在哪个控件上触发的事件,其中true为非当前选择框触发
而false则为当前选择框触发
调用方式:TableFunction().WriteSelect(obj,values,action,getobj)
†.RewriteTableStr()
复位重写表格中的日期
参数:
y是指年
m是指月
调用方式:TableFunction().RewriteTableStr(Year,Month)
‡.JumpToRun()
左右控制表格中的月变化
参数:
action表示日历是前进还是后退
调用方式:TableFunction().JumpToRun(action)
ˆ.AlertDay()
提示当前点击的位置的日期
参数:
无
调用方式:TableFunction().AlertDay()
*********************************************************/
function TableFunction(){
this.GetDateStr=function(y,m){
this.DayArray=[];
for(var i=0;i<42;i++)this.DayArray=" ";
for(var i=0;i<new Date(y,m,0).getDate();i++)this.DayArray=i+1;
return this.DayArray;
}
this.GetTableStr=function(y,m){
this.DateArray=["日","一","二","三","四","五","六"];
this.DStr="<table oncontextmenu='return false' onselectstart='return false' style='width:160;cursor:default;border:1 solid #9c9c9c;border-right:0;border-bottom:0;filter:progid:dximagetransform.microsoft.dropshadow(color=#e3e3e3,offx=3,offy=3,positive=true)' border='0' cellpadding='0' cellspacing='0'>\n"+
"<tr><td colspan='7' class='TrOut'>"+
"<table width='100%' height='100%'border='0' cellpadding='0' cellspacing='0'><tr align='center'>\n"+
"<td width='20' style='font-family:\"webdings\";font-size:9pt' onclick='TableFunction().JumpToRun(\"b\")' onmouseover='this.style.color=\"#ff9900\"' onmouseout='this.style.color=\"\"'>3</td>\n"+
"<td id='YearTD' width='70' onmouseover='this.style.background=\"#cccccc\"' onmouseout='this.style.background=\"\"' onclick='TableFunction().WriteSelect(this,this.innerText.split(\" \"),\"y\",false)'>"+y+" 年</td>\n"+
"<td id='MonthTD' width='47' onmouseover='this.style.background=\"#cccccc\"' onmouseout='this.style.background=\"\"' onclick='TableFunction().WriteSelect(this,this.innerText.split(\" \"),\"m\",false)'>"+m+" 月</td>\n"+
"<td width='20' style='font-family:\"webdings\";font-size:9pt' onclick='TableFunction().JumpToRun(\"n\")' onmouseover='this.style.color=\"#ff9900\"' onmouseout='this.style.color=\"\"'>4</td></tr></table>\n"+
"</td></tr>\n"+
"<tr align='center'>\n";
for(var i=0;i<7;i++)
this.DStr+="<td class='TrOut'>"+DateArray+"</td>\n";
this.DStr+="</tr>\n";
for(var i=0;i<6;i++){
this.DStr+="<tr align='center'>\n";
for(var j=0;j<7;j++){
var CS=defaultDate.getDate()==this.GetDateStr(y,m)?"TdOver":"TdOut";
this.DStr+="<td id='TD' class='"+CS+"' cs='"+CS+"' onmouseover='this.className=\"TdOver\"' onmouseout='if(this.cs!=\"TdOver\")this.className=\"TdOut\"' onclick='TableFunction().AlertDay()'>"+this.GetDateStr(y,m)+"</td>\n";
}
this.DStr+="</tr>\n";
}
this.DStr+="</tabe>";
return this.DStr;
}
this.WriteSelect=function(obj,values,action,getobj){
if(values=="")return;
if(getobj){
obj.innerHTML=values+(action=="y"?" 年":" 月");
this.RewriteTableStr(YearTD.innerText.split(" "),MonthTD.innerText.split(" "));
return false;
}
var StrArray=[];
if(action=="y"){
for(var i=0;i<15;i++){
var year=values-7+i;
StrArray="<option value='"+year+"' "+(values==year?"selected":"")+"> "+year+"年</option>\n";
}
obj.innerHTML="<select id='select1' style='width:67' onchange='TableFunction().WriteSelect(parentElement,this.value,\"y\",true)' onblur='YearTD.innerText=this.value+\" 年\"'>\n"+StrArray.join("")+"</select>";
select1.focus();
}
if(action=="m"){
for(var i=1;i<13;i++)
StrArray="<option value='"+i+"' "+(i==values?"selected":"")+"> "+i+"月</option>\n";
obj.innerHTML="<select id='select2' style='width:47' onchange='TableFunction().WriteSelect(parentElement,this.value,\"m\",true)' onblur='MonthTD.innerText=this.value+\" 月\"'>\n"+StrArray.join("")+"</select>";
select2.focus();
}
}
this.RewriteTableStr=function(y,m){
var TArray=this.GetDateStr(y,m);
var len=TArray.length;
for(var i=0;i<len;i++){
TD.innerHTML=TArray;
TD.className="TdOut";
TD.cs="TdOut";
if(new Date().getYear()==y&&new Date().getMonth()+1==m&&new Date().getDate()==TArray){
TD.className="TdOver";
TD.cs="TdOver";
}
}
}
this.JumpToRun=function(action){
var YearNO=YearTD.innerText.split(' ');
var MonthNO=MonthTD.innerText.split(' ');
if(action=="b"){
if(MonthNO=="1"){
MonthNO=13;
YearNO=YearNO-1;
}
MonthTD.innerText=MonthNO-1+" 月";
YearTD.innerText=YearNO+" 年";
this.RewriteTableStr(YearNO,MonthNO-1);
}
if(action=="n"){
if(MonthNO=="12"){
MonthNO=0;
YearNO=YearNO-(-1);
}
YearTD.innerText=YearNO+" 年";
MonthTD.innerText=MonthNO-(-1)+" 月";
this.RewriteTableStr(YearNO,MonthNO-(-1));
}
}
this.AlertDay=function(){
if(event.srcElement.innerText!=" "){
var d=new Date( parseInt(YearTD.innerText.split(' '),10),parseInt(MonthTD.innerText.split(' '),10)-1,parseInt(event.srcElement.innerText,10));
window.returnValue=d.getTime();
window.close();//点击日期会关闭窗口
}
}
return this;
}
var defaultDate=new Date();
if(typeof(dialogArguments)!="undefined")defaultDate=dialogArguments;
document.write(TableFunction().GetTableStr(defaultDate.getYear(),defaultDate.getMonth()+1));
</script>
</body>
</html> 原帖由 yellky 于 2007-3-7 23:02 发表
<head><script>function colorpicker() {var sColor=dlgHelper.ChooseColorDlg();ColorVal=sColor.toString(16);colorvalue.value=(ColorVal.length==6)?"#"+ColorVal.toUpperCase():& ...
这个不错。呵呵 没教程,看不了 原帖由 clheart 于 2007-3-9 16:33 发表 http://www.kofans.cn/bbs/static/image/common/back.gif
没教程,看不了
代码就是最好的教程
偶从来都没耐心看教程,直接看代码,看多了就贯通了....:)
页:
[1]
2