64200多个js技巧代码Word下载.docx

上传人:b****5 文档编号:16690157 上传时间:2022-11-25 格式:DOCX 页数:73 大小:49.44KB
下载 相关 举报
64200多个js技巧代码Word下载.docx_第1页
第1页 / 共73页
64200多个js技巧代码Word下载.docx_第2页
第2页 / 共73页
64200多个js技巧代码Word下载.docx_第3页
第3页 / 共73页
64200多个js技巧代码Word下载.docx_第4页
第4页 / 共73页
64200多个js技巧代码Word下载.docx_第5页
第5页 / 共73页
点击查看更多>>
下载资源
资源描述

64200多个js技巧代码Word下载.docx

《64200多个js技巧代码Word下载.docx》由会员分享,可在线阅读,更多相关《64200多个js技巧代码Word下载.docx(73页珍藏版)》请在冰豆网上搜索。

64200多个js技巧代码Word下载.docx

height:

17px;

width:

25pt;

font-size:

9pt;

BACKGROUND-COLOR:

#E8E8FF;

color:

#666666"

5.按钮颜色变化

inputtype=textname="

nick"

style="

1pxsolid#666666;

#F4F4FF;

#ff6600"

size="

15"

maxlength="

16"

6.平面输入框

T1"

20"

border-style:

solid;

border-width:

1"

7.使窗口变成指定的大小

script>

window.resizeTo(300,283);

/script>

8.使文字上下滚动

marqueedirection=upscrollamount=1scrolldelay=100onmouseover='

this.stop()'

onmouseout='

this.start()'

height=60>

!

--head_scrolltext-->

tr>

td>

共和国

/table>

<

--endhead_scrolltext-->

/marquee>

9.状态栏显示该页状态

baseonmouseover="

window.status='

网站建设;

returntrue"

10.可以点击文字实现radio选项的选定

br>

&

nbsp;

radio"

regtype"

A03"

id="

labelfor="

情侣:

一次注册两个帐户<

/label>

11.可以在文字域的font写onclick事件

12.打印<

/a>

打印网页

ahref='

javascript:

window.print()'

13.线型输入框

key"

12"

关键字"

onFocus=this.select()onMouseOver=this.focus()

class="

line"

14.显示文档最后修改日期

scriptlanguage=javascript>

functionhi(str)

{

document.write(document.lastModified)

alert("

hi"

+str+"

"

}

15.可以在鼠标移到文字上时就触发事件

html>

head>

scriptlanguage="

LiveScript"

--Hiding

functionhello(){

哈罗!

);

}

/head>

body>

ahref="

onMouseOver="

hello()"

link<

/body>

/html>

16.可以根据网页上的选项来确定页面颜色

HTML>

HEAD>

TITLE>

background.html<

/TITLE>

/HEAD>

SCRIPT>

--

functionbgChange(selObj){

newColor=selObj.options[selObj.selectedIndex].text;

document.bgColor=newColor;

selObj.selectedIndex=-1;

//-->

/SCRIPT>

BODYSTYLE="

font-family:

Arial"

B>

ChangingBackgroundColors<

/B>

BR>

FORM>

SELECTSIZE="

8"

onChange="

bgChange(this);

OPTION>

Red

Orange

Yellow

Green

Blue

Indigo

Violet

White

pink

/SELECT>

/FORM>

/BODY>

/HTML>

17.将按钮的特征改变

styletype="

text/css"

.style1{font-size:

12px;

background:

#CCCCFF;

thinthinthinthin;

border-color:

#CCCCFF

#CCCCCC#CCCCCC#CCCCFF}

.style2{font-size:

font-weight:

bold;

#CCFFCC;

thinmediummediumthin;

border-color:

#CCFF99#999999#999999#CCFF99}

-->

/style>

  本例按钮的代码如下:

Submit"

提交"

onmouseover="

this.className='

style2'

onmouseout="

style1'

style1"

18.改变按钮的图片.

.style3{font-size:

url(image/buttonbg1.gif);

border:

0px;

60px;

22px}

.style4{font-size:

url(image/buttonbg2.gif);

0px0;

60px;

  本例的按钮代码如下:

Submit2"

style4'

style3'

style3"

19.打印页面

divalign="

center"

aclass=contenthref="

doPrint();

打印本稿<

/div>

20.可以直接写html语言

document.write("

21.改变下拉框的颜色

selectname="

classid"

onChange="

changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)"

size="

1"

color:

#008080;

font-size:

9pt"

22.转至目标URL

window.location="

http:

//guoguo"

23.传递该object的form

UpdateSN('

guoqiang99267'

this.form)

functionUpdateSN(strValue,strForm)

strForm.SignInName.value=strValue;

returnfalse;

24.文字标签

AltName4"

inputname="

AltName"

type="

RADIO"

tabindex="

931"

guoqiang99859<

25.layer2为组件的ID,可以控制组件是否可见

document.all.item('

Layer2'

).style.display="

block"

;

none"

//

26.将页面加入favorite中

functionAddme(){

url="

//your.site.address"

//你自己的主页地址

title="

YourSiteName"

//你自己的主页名称

window.external.AddFavorite(url,title);

27.过10秒自动关闭页面

scriptlanguage="

JavaScript"

>

functioncloseit(){

setTimeout("

self.close()"

,10000)

/script>

28.可以比较字符的大小

char=post.charAt(i);

if(!

('

0'

=char&

char<

='

9'

))

29.将字符转化为数字

month=parseInt(char)

30.点击value非空的选项时转向指定连接

selectonchange='

if(this.value!

="

)window.open(this.value)'

textinput"

optionselected>

主办单位<

/option>

option>

-----------------<

optionvalue="

/select>

31.改变背景颜色

tdwidth=*class=dpbgColor=#FAFBFConmouseover="

this.bgColor='

#FFFFFF'

#FAFBFC'

32.改变文字输入框的背景颜色

style>

.input2{background-image:

url('

../images/inputbg.gif'

background-color:

#D0DABB;

border-top-width:

1px;

border-right-width:

1px;

border-bottom-width:

border-left-width:

1px}

inputname=contenttype=textsize="

47"

input2"

50"

33.改变水平线的特征

hrsize="

0"

noshadecolor="

#C0C0C0"

34.传递参数的方式

vote.asp?

CurPage=8&

id=3488"

8<

35.页内跳转

#1"

1<

#2"

2<

#3"

3<

#4"

4<

#5"

5<

#6"

6<

#7"

7<

aname="

dfdf<

2"

36.两个按键一起按下

if(event.ctrlKey&

window.event.keyCode==13)//

37.刷新页面

this.location.reload()//

38.将网页的按钮使能

SCRIPTLANGUAGE="

functionhaha()

for(vari=0;

i<

document.form1.elements.length;

i++)

{

if(document.form1.elements[i].name.indexOf("

bb"

)!

=-1)

document.form1.elements[i].disabled=!

document.form1.elements[i].disabled;

BODY>

formname=form1>

INPUTTYPE="

NAME="

aa"

value=cindyonclick=haha()>

bb"

value=guoguo>

39.文字移动

marqueescrollamount=3onmouseover=this.stop();

onmouseout=this.start();

40.双击网页自动跑

varcurrentpos,timer;

functioninitialize()

timer=setInterval("

scrollwindow()"

1);

functionsc()

clearInterval(timer);

functionscrollwindow()

currentpos=document.body.scrollTop;

window.scroll(0,++currentpos);

if(currentpos!

=document.body.scrollTop)

sc();

document.onmousedown=sc

document.ondblclick=initialize

41.后退

onclick=window.history.back()value=back>

42.前进

onclick=window.history.forward()value=forward>

43.刷新

onclick=document.location.reload()value=reload>

44.转向指定网页

document.location="

//ww"

或者document.location.assign("

45.在网页上显示实时时间

varclock_id;

window.onload=function()

clock_id=setInterval("

document.form1.txtclock.value=(newDate);

1000)

46.可以下载文件

document.location.href="

目标文件"

47.连接数据库

importjava.sql.*;

StringmyDBDriver="

sun.jdbc.odbc.JdbcOdbcDriver"

Class.forName(myDBDriver);

Connectionconn=DriverManager.getConnection("

jdbc:

odbc:

firm"

"

username"

password"

Statementstmt=conn.createStatement();

ResultSetrs=stmt.executeQuery(sql);

rs.getString("

column1"

48.可以直接在页面“div”内写下所需内容

onclick="

a1.innerHTML='

fontcolor=red>

*<

/font>

divid=a1>

49.可以改变页面上的连接的格式,使其为双线

A:

link{text-decoration:

none;

#0000FF;

font-family:

宋体}

visited{text-decoration:

#0000FF;

hover{text-decoration:

underlineoverline;

FF0000}

underlineoverlineline-through;

TH{FONT-SIZE:

9pt}

TD{FONT-SIZE:

body{SCROLLBAR-FACE-COLOR:

#A9D46D;

SCROLLBAR-HIGHLIGHT-COLOR:

#e7e7e7;

SCROLLBAR-SHADOW-COLOR:

#e7e7e7;

SCROLLBAR-3DLIGHT-COLOR:

#000000;

LINE-HEIGHT:

15pt;

SCROLLBAR-ARROW-COLOR:

#ffffff;

SCROLLBAR-TRACK-COLOR:

INPUT{BORDER-TOP-WIDTH:

PADDING-RIGHT:

PADDING-LEFT:

BORDER-LEFT-WIDTH:

FONT-SIZE:

BORDER-LEFT-COLOR:

#cccccc;

BORDER-BOTTOM-WIDTH:

BORDER-BOTTOM-COLOR:

PADDING-BOTTOM:

BORDER-TOP-COLOR:

PADDING-TOP:

HEIGHT:

18px;

BORDER-RIGHT-WIDTH:

BORDER-RIGHT-COLOR:

#cccccc}

DIV,form,OPTION,P,TD,BR{FONT-FAMILY:

宋体;

textarea,select{border-width:

1;

#efefef;

9pt;

font-style:

.text{font-family:

"

宋体"

#003300;

#006600solid;

1px1px

1px1px}

完整的css

50.新建frame

a

href="

newframe('

/a_13.html'

)"

imgalt=帮助border=0src="

51.向文件中写内容

%@pageimport="

java.io.*"

%>

%

Stringstr="

printme"

//alwaysgivethepathfromroot.Thiswayitalmostalwaysworks.

StringnameOfTextFile="

/usr/anil/imp.txt"

try

PrintWriterpw=newPrintWriter(newFileOutputStream(nameOfTextFile));

pw.println(str);

//cleanup

pw.close();

catch(IOExceptione)

out.println(e.getMessage());

%>

52.先读文件再写文件

%@pagelanguage="

java"

%@pagecontentType="

text/html;

charSet=gb2312"

%@pageimport="

java.util.*"

%@pagei

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 其它语言学习

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

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