多个网页设计常用技巧代码.docx

上传人:b****3 文档编号:3943826 上传时间:2023-05-06 格式:DOCX 页数:25 大小:26.98KB
下载 相关 举报
多个网页设计常用技巧代码.docx_第1页
第1页 / 共25页
多个网页设计常用技巧代码.docx_第2页
第2页 / 共25页
多个网页设计常用技巧代码.docx_第3页
第3页 / 共25页
多个网页设计常用技巧代码.docx_第4页
第4页 / 共25页
多个网页设计常用技巧代码.docx_第5页
第5页 / 共25页
多个网页设计常用技巧代码.docx_第6页
第6页 / 共25页
多个网页设计常用技巧代码.docx_第7页
第7页 / 共25页
多个网页设计常用技巧代码.docx_第8页
第8页 / 共25页
多个网页设计常用技巧代码.docx_第9页
第9页 / 共25页
多个网页设计常用技巧代码.docx_第10页
第10页 / 共25页
多个网页设计常用技巧代码.docx_第11页
第11页 / 共25页
多个网页设计常用技巧代码.docx_第12页
第12页 / 共25页
多个网页设计常用技巧代码.docx_第13页
第13页 / 共25页
多个网页设计常用技巧代码.docx_第14页
第14页 / 共25页
多个网页设计常用技巧代码.docx_第15页
第15页 / 共25页
多个网页设计常用技巧代码.docx_第16页
第16页 / 共25页
多个网页设计常用技巧代码.docx_第17页
第17页 / 共25页
多个网页设计常用技巧代码.docx_第18页
第18页 / 共25页
多个网页设计常用技巧代码.docx_第19页
第19页 / 共25页
多个网页设计常用技巧代码.docx_第20页
第20页 / 共25页
亲,该文档总共25页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

多个网页设计常用技巧代码.docx

《多个网页设计常用技巧代码.docx》由会员分享,可在线阅读,更多相关《多个网页设计常用技巧代码.docx(25页珍藏版)》请在冰点文库上搜索。

多个网页设计常用技巧代码.docx

多个网页设计常用技巧代码

1.文本框焦点问题

  onBlur:

当失去输入焦点后产生该事件

  onFocus:

当输入获得焦点后,产生该文件

  Onchange:

当文字值改变时,产生该事件

  Onselect:

当文字加亮后,产生该文件

  

  

  (value==''){value='mm'}">点击时文字消失,失去焦点时文字再出现

  

  

  2.网页按钮的特殊颜色

  

  

  style="background-color:

rgb(235,207,22)">

  

  3.鼠标移入移出时颜色变化

  

  

  onMouseOver=this.style.color="red"class="button">

  

  4.平面按钮

  

1pxsolid:

#666666。

height:

17px。

width:

25pt。

font-size:

9pt。

  

  BACKGROUND-COLOR:

#E8E8FF。

color:

#666666"name="submit">

  

  5.按钮颜色变化

  

1pxsolid#666666。

font-size:

9pt。

height:

17px。

  

  BACKGROUND-COLOR:

#F4F4FF。

color:

#ff6600"size="15"maxlength="16">

  

  6.平面输入框

  

solid。

border-width:

1">

  

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

  

  

  8.使文字上下滚动

  

  

  height=60>

  

--head_scrolltext-->

  

  

  共和国

  

--endhead_scrolltext-->

  

  

  9.状态栏显示该页状态

  

returntrue">

  

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

  

  

  情侣:

一次注册两个帐户

  

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

  

  12.打印打印网页

  

window.print()'>

  

  13.线型输入框

  

  

  class="line">

  

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

  

  functionhi(str)

  {

  document.write(document.lastModified)

  

  alert("hi"+str+"!

")

  }

  

  

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

  

  

  

  

--Hiding

  functionhello(){

  alert("哈罗!

")。

  }

  

  

  

  link

  

  

  

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

  

  

  background.html

  

  

  

Arial">

  ChangingBackgroundColors

  

  

  

">

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  17.将按钮的特征改变

  

  

--

  .style1{font-size:

12px。

background:

#CCCCFF。

border-width:

thinthinthinthin。

border-color:

#CCCCFF

  

  #CCCCCC#CCCCCC#CCCCFF}

  .style2{font-size:

12px。

font-weight:

bold。

background:

#CCFFCC。

border-width:

thinmediummediumthin。

  

  border-color:

#CCFF99#999999#999999#CCFF99}

  -->

  

    本例按钮的代码如下:

  

  

  onmouseout="this.className='style1'"class="style1">

  

  18.改变按钮的图片.

  

  

--

  .style3{font-size:

12px。

background:

url(image/buttonbg1.gif)。

border:

0px。

width:

60px。

height:

22px}

  .style4{font-size:

12px。

font-weight:

bold。

background:

url(image/buttonbg2.gif)。

border:

0px0。

width:

  

  60px。

height:

22px}

  -->

  

    本例的按钮代码如下:

  

  

  onmouseout="this.className='style3'"class="style3">

  

  19.打印页面

  

doPrint()。

">打印本稿

  

  20.可以直接写html语言

  document.write("")。

  

  21.改变下拉框的颜色

  

  

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

  

  size="1"style="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.文字标签

  

  

  >guoqiang99859

  

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

  document.all.item('Layer2').style.display="block"。

  document.all.item('Layer2').style.display="none"。

//

  

  26.将页面加入favorite中

  

  

--

  functionAddme(){

  url="http:

//your.site.address"。

//你自己的主页地址

  title="YourSiteName"。

//你自己的主页名称

  window.external.AddFavorite(url,title)。

  -->

  //

  

  27.过10秒自动关闭页面

  

  functioncloseit(){

  setTimeout("self.close()",10000)

  }

  

  

  28.可以比较字符的大小

  char=post.charAt(i)。

  if(!

('0'<=char&&char<='9'))

  

  29.将字符转化为数字

  month=parseInt(char)

  

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

  

="")window.open(this.value)'class="textinput">

  主办单位

  

  

  

  

  

  31.改变背景颜色

  

"

  

  onmouseout="this.bgColor='#FAFBFC'。

">

  

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

  

  

  

  33.改变水平线的特征

  

  

  34.传递参数的方式

  

CurPage=8&id=3488">8

  

  35.页内跳转

  1

  2

  3

  4

  5

  6

  7

  dfdf

  dfdf//

  

  36.两个按键一起按下

  if(event.ctrlKey&&window.event.keyCode==13)//

  

  37.刷新页面

  javascript:

this.location.reload()//

  

  38.将网页的按钮使能

  

  functionhaha()

  {

  for(vari=0。

i

i++)

  {

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

=-1)

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

document.form1.elements[i].disabled。

  }

  }

  

  

  

  

  

  

  39.文字移动

  

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.后退

  

  

  42.前进

  

  

  43.刷新

  

  

  44.转向指定网页

  document.location="http:

//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”内写下所需内容

  *'">

  

//

  

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