网页制作常用代码.docx

上传人:b****6 文档编号:5623306 上传时间:2022-12-29 格式:DOCX 页数:31 大小:38.74KB
下载 相关 举报
网页制作常用代码.docx_第1页
第1页 / 共31页
网页制作常用代码.docx_第2页
第2页 / 共31页
网页制作常用代码.docx_第3页
第3页 / 共31页
网页制作常用代码.docx_第4页
第4页 / 共31页
网页制作常用代码.docx_第5页
第5页 / 共31页
点击查看更多>>
下载资源
资源描述

网页制作常用代码.docx

《网页制作常用代码.docx》由会员分享,可在线阅读,更多相关《网页制作常用代码.docx(31页珍藏版)》请在冰豆网上搜索。

网页制作常用代码.docx

网页制作常用代码

网页的HTML基本代码

贴图:

;加入连接:

写上你想写的字;

在新窗口打开连接:

写上要写的字;

移动字体(走马灯):

写上你想写的字;字体加粗:

写上你想写的字

字体斜体:

写上你想写的字; 字体下划线:

写上你想写的字;

字体删除线:

写上你想写的字;字体加大:

 写上你想写的字;

字体控制大小:

写上你想写的字

(其中字体大小可从h1-h5,h1最大,h5最小);

更改字体颜色:

写上你想写的字(其中value值在000000与ffffff(16位进制)之间;消除连接的下划线:

none">写上你想写的字;

贴音乐:

;

贴flash:

;

贴影视文件:

;

换行:


;段落:

段落

;原始文字样式:

正文
;换帖子背景:

;固定帖子背景不随滚动条滚动:

;

定制帖子背景颜色:

(value值见10);帖子背景音乐:

;贴网页:

以下代码是让滚动文字字幕的代码:

文字一

文字二

文字三

文字四

文字五


里面的参数修改一下,效果将不一样,这里仅提醒一下direction参数,可以改为向下(down)、向左(left)和向右(right)。

(网上搜集)

自定义鼠标代码

a:

hover{cursor:

url(‘

BODY{cursor:

url(‘

投后广告代码

window.open(‘1.htm‘,‘eachnet‘,‘toolbar=0‘);

setTimeout("focus();",5);

支持多种格式视频及音频播放代码(wma,wmv,mp3,avi,swf,及rm,rmvb等等)

  //说明:

autostart="true"为自动播放true改false则手动播放

强制更改网页标题代码-网页放入框架一样显示的标题

top.document.title="阳春非凡-

飘浮在最前面的浮动广告

--

//1)specifypathtoimage//ͼƬµÄÂ?

¤¾¶

varimagepath="

//2)specifyimagedimensions//ͼƬµÄ´¨?

С

varimagewidth=88

varimageheight=31

//3)changethistoadjustspeed(lowerisslower)//ËÙ¶È

varspeed=3;

//4)configurewhatshouldhappenwhenuserclicksonimage

//Avalueof"dismiss"willdismissit,whileaURLwillcausethebrowsertonavigatetoit

varimageclick=""

//5)Finally,configurewhentheimageshouldautomaticallydisappear,inseconds(0=perpetual)

varhideafter=0

////Noeditingrequiredbeyondthispoint/////////////////

varisie=0;

if(window.navigator.appName=="MicrosoftInternetExplorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5){

isie=1;

}

else{

isie=0;

}

if(isie){

varpreloadit=newImage()

preloadit.src=imagepath

}

functionpop(){

if(isie){

x=x+dx;y=y+dy;

oPopup.show(x,y,imagewidth,imageheight);

if(x+imagewidth+5>screen.width)dx=-dx;

if(y+imageheight+5>screen.height)dy=-dy;

if(x<0)dx=-dx;

if(y<0)dy=-dy;

startani=setTimeout("pop();",50);

}

}

functiondismisspopup(){

clearTimeout(startani)

oPopup.hide()

}

functiondowhat(){

if(imageclick=="dismiss")

dismisspopup()

else

window.open(imageclick);

}

if(isie){

varx=0,y=0,dx=speed,dy=speed;

varoPopup=window.createPopup();

varoPopupBody=oPopup.document.body;

oPopupBody.style.cursor="hand"

oPopupBody.innerHTML=‘‘;

oPopup.document.body.onmouseover=newFunction("clearTimeout(startani)")

oPopup.document.body.onmouseout=pop

oPopup.document.body.onclick=dowhat

pop();

if(hideafter>0)

setTimeout("dismisspopup()",hideafter*1000)

}

//-->

  1.弹启一个全屏窗口

;

  2.弹启一个被F11化后的窗口

;

  3.弹启一个带有收藏链接工具栏的窗口

  4.网页对话框

--

showModalDialog(‘

dialogLeft:

200px;dialogTop:

150px;center:

yes;help:

yes;resizable:

yes;status:

yes‘)

//-->

--

showModelessDialog(‘

dialogLeft:

200px;dialogTop:

150px;center:

yes;help:

yes;resizable:

yes;status:

yes‘)

//-->

参数说明

showModalDialog()或是showModelessDialog()来调用网页对话框,至于showModalDialog()与showModelessDialog()的区别,

在于showModalDialog()打开的窗口(简称模式窗口),置在父窗口上,必须关闭才能访问父窗口(建议尽量少用,以免招人反感);

showModelessDialog()(简称无模式窗口),打开后不必关闭也可访问父窗口打开的窗口。

dialogHeight:

iHeight设置对话框窗口的高度。

dialogWidth:

iWidth设置对话框窗口的宽度。

  

dialogLeft:

iXPos设置对话框窗口相对于桌面左上角的left位置。

dialogTop:

iYPos设置对话框窗口相对于桌面左上角的top位置。

center:

{yes|no|1|0}指定是否将对话框在桌面上居中,默认值是“yes”。

help:

{yes|no|1|0}指定对话框窗口中是否显示上下文敏感的帮助图标。

默认值是“yes”。

  

resizable:

{yes|no|1|0}指定是否对话框窗口大小可变。

默认值是“no”。

status:

{yes|no|1|0}指定对话框窗口是否显示状态栏。

对于非模式对话框窗口,默认值是“yes”;

对于模式对话框窗口,默认值是“no”。

定义打开网页时起始窗口的大小

window.resizeTo(500,300)

随机数:

<%randomize%>

<%=(int(rnd()*n)+1)%>

查询数据时得到的记录关键字用红色显示:

replace(RS("字段X"),searchname,""&searchname&"")

通过asp的手段来检查来访者是否用了代理

<%ifRequest.ServerVariables("HTTP_X_FORWARDED_FOR")<>""then

response.write"您通过了代理服务器,"&_

"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")

endif

%>

判断上一页的来源

request.servervariables("HTTP_REFERER")

javascript:

document.referrer

清除缓存,重新加载页面

<%response.expires=0

response.expiresabsolute=now()-1

response.addHeader"pragma","no-cache"

response.addHeader"cache-control","private"

Response.cachecontrol="no-cache"

%>

检索并删除数据库里的重复记录

conn.execute("deletefromtablewhereidnotin(selectdistinctfromtable)")

文件删除函数<%

‘文件删除函数

functiondeletefile(filename)

iffilename<>""then

setfso=server.CreateObject("scripting.filesystemobject")

iffso.FileExists(filename)then

fso.DeleteFilefilename

else

Response.Write""

endif

endif

endfunction

strfile=server.MapPath("fileName")

deletefile(strfile)

%>

ASP字数计算函数<%

FunctionWordCount(strInput)

DimstrTemp

strTemp=Replace(strInput,vbTab,"")

strTemp=Replace(strTemp,vbCr,"")

strTemp=Replace(strTemp,vbLf,"")

‘删除字首字尾空格

strTemp=Trim(strTemp)

‘替换为一个空格

DoWhileInStr(1,strTemp,"",1)<>0

strTemp=Replace(strTemp,"","")

Loop

WordCount=UBound(Split(strTemp,"",-1,1))+1

EndFunction

%>

全正则的检测IP是否合法的函数functioncheckIP2(sIPAddress)

{

varexp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;

varreg=sIPAddress.match(exp);

varErrMsg="你输入的是一个非法的IP地址段!

\nIP段为:

:

xxx.xxx.xxx.xxx(xxx为0-255)!

"

varMsg="你输入的是一个合法的IP地址段!

"

if(reg==null)

{

alert(ErrMsg);

}

else

{

alert(reg);

}

}

关闭子窗口时刷新父窗口在子窗口

window.opener.location="父窗口页面"

window.close()

文本框输入限制:

小写英文:

inline">

onpaste="returnregInput(this,/^[a-z]*$/,window.clipboardData.getData(‘Text‘))"

ondrop="returnregInput(this,/^[a-z]*$/,event.dataTransfer.getData(‘Text‘))"

style="ime-mode:

Disabled"

>

大写英文:

inline">

onpaste="returnregInput(this,/^[A-Z]*$/,window.clipboardData.getData(‘Text‘))"

ondrop="returnregInput(this,/^[A-Z]*$/,event.dataTransfer.getData(‘Text‘))"

style="ime-mode:

Disabled">


任意数字:

inline">

onpaste="returnregInput(this,/^[0-9]*$/,window.clipboardData.getData(‘Text‘))"

ondrop="returnregInput(this,/^[0-9]*$/,event.dataTransfer.getData(‘Text‘))"

style="ime-mode:

Disabled"

>

限2位小数:

inline">

\d{0,2}$/,String.fromCharCode(event.keyCode))"

onpaste="returnregInput(this,/^\d*\.?

\d{0,2}$/,window.clipboardData.getData(‘Text‘))"

ondrop="returnregInput(this,/^\d*\.?

\d{0,2}$/,event.dataTransfer.getData(‘Text‘))"

style="ime-mode:

Disabled"

>如:

123.12

日 期:

inline">

)?

)?

)?

$/,String.fromCharCode(event.keyCode))"

onpaste="returnregInput(this,/^\d{1,4}([-\/](\d{1,2}([-\/](\d{1,2})?

)?

)?

)?

$/,window.clipboardData.getData(‘Text‘))"

ondrop="returnregInput(this,/^\d{1,4}([-\/](\d{1,2}([-\/](\d{1,2})?

)?

)?

)?

$/,event.dataTransfer.getData(‘Text‘))"

style="ime-mode:

Disabled"

>如:

2002-9-29

任意中文:

inline">

展开阅读全文
相关搜索

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1