Linux中国  设为主页
 收藏本站
 
当前位置: > 首页 ->网站设计 ->JavaScript ->js技巧收集(200多个)
  相关分类: 
AJAX教程
CSS/CSS2
Dreamweaver
Fireworks
Flash
HTML/DHTML
JavaScript
Phososhop
网页制作
  站内搜索: 
热门文章排行
热门文章排行 网页对联广告代码效果大全(06-05)
用JavaScript判断日期、数字、整数(04-13)
各种网页播放器代码大全(04-13)
几个很有用的javascript函数(04-13)
JavaScript方法和技巧大全(06-05)
精采文章排行
精采文章排行 用javascript+php随机显示图片(06-05)
限制文本字节数的JS源代码程序(06-05)
用来实现Web页面图片移动托拽的代码(06-05)
开发跨浏览器JavaScript时要注意的问(06-05)
javascript分页(06-05)
  ·限制文本字节数的JS源代码程序·用来实现Web页面图片移动托拽的代码段·开发跨浏览器JavaScript时要注意的问题·javascript分页·使用Javascript制作声音按钮·JavaScript技巧:让网页自动穿上外套·Javascript模拟的DOS窗口·利用javascript从数据库取数据来实现CSDN·将js文件编译成动态链接库(dll)文件

js技巧收集(200多个)

作者:Webmaster   来源:Linuxdby.com   点击:   日期:2007-06-05 [收藏] [投稿]

  IE是否经常中毒?推荐您


  级别:<input type=text datasrc=#theXMLisland DataFLD=Grade size="76"><HR>
  <input id="first" TYPE=button value="<< 第一条记录"     onclick="theXMLisland.recordset.moveFirst()">
  <input id="prev" TYPE=button value="<上一条记录"   onclick="theXMLisland.recordset.movePrevious()"> 
  <input id="next" TYPE=button value="下一条记录>" onclick="theXMLisland.recordset.moveNext()"> 
  <input id="last" TYPE=button value="最后一条记录>>" onclick="theXMLisland.recordset.moveLast()">&nbsp; 
  <input id="Add" TYPE=button value="添加新记录" onclick="theXMLisland.recordset.addNew()"> 

  <XML ID="theXMLisland">
  <HotelList>
  <Hotel>
  <Name>四海大酒店</Name>
  <Address>海魂路1号</Address>
  <HomePage>www.sihaohotel.com.cn</HomePage>
  <E-Mail>master@sihaohotel.com.cn</E-Mail>
  <TelePhone>(0989)8888888</TelePhone>
  <Grade>五星级</Grade>
  </Hotel>
  <Hotel>
  <Name>五湖宾馆</Name>
  <Address>东平路99号</Address>
  <HomePage>www.wuhu.com.cn</HomePage>
  <E-Mail>web@wuhu.com.cn</E-Mail>
  <TelePhone>(0979)1111666</TelePhone>
  <Grade>四星级</Grade>
  </Hotel>
  <Hotel>
  <Name>“大沙漠”宾馆</Name>
  <Address>留香路168号</Address>
  <HomePage>www.dashamohotel.com.cn</HomePage>
  <E-Mail>master@dashamohotel.com.cn</E-Mail>
  <TelePhone>(0989)87878788</TelePhone>
  <Grade>五星级</Grade>
  </Hotel>
  <Hotel>
  <Name>“画眉鸟”大酒店</Name>
  <Address>血海飘香路2号</Address>
  <HomePage>www.throstlehotel.com.cn</HomePage>
  <E-Mail>chuliuxiang@throstlehotel.com.cn</E-Mail>
  <TelePhone>(099)9886666</TelePhone>
  <Grade>五星级</Grade>
  </Hotel>
  </HotelList>
  </XML>

  </body> 
  </HTML> //xml数据岛中添加记录


-------------------------------
  The following list is a sample of the properties and methods that you use to access nodes in an XML

document.

Property/    Method Description
XMLDocument Returns a reference to the XML Document Object Model (DOM) exposed by the object. 

documentElement  Returns the document root of the XML document.
childNodes    Returns a node list containing the children of a node (if any).
item     Accesses individual nodes within the list through an index. Index values are zero-based, so

item(0) returns the first child node.
text     Returns the text content of the node.

The following code shows an HTML page containing an XML data island. The data island is contained within

the <XML> element.

<HTML>
  <HEAD>
    <TITLE>HTML with XML Data Island</TITLE>
  </HEAD>
  <BODY>
    <P>Within this document is an XML data island.</P>

    <XML ID="resortXML">
      <resorts>
        <resort code='1'>Adventure Works</resort>
        <resort>Alpine Ski House</resort>
      </resorts>
    </XML>

  </BODY>
</HTML>
For an example, you can cut and paste this sample line of code:

resortXML.XMLDocument.documentElement.childNodes.item(1).text//读取页面上的XML数据岛中的数据
resortXML.documentElement.childNodes.item(0).getAttribute("code")//读取页面上的XML数据岛中的数据
resortXML.documentElement.childNodes[0].getAttribute("code")//读取页面上的XML数据岛中的数据

199.模式窗口
父窗口
var url="aaa.jsp";
var

data=showModalDialog(url,null,"dialogHeight:400px;dialogHeight:600px;center:yes;help:No;status:no;resizab

le:Yes;edge:sunken");
if(data)
 alert(data.value);
 
子窗口
var data=new Object();
data.value1="china";
window.returnValue=data;
window.close();

 
200.动态设置事件,带参数
<INPUT TYPE="text" NAME="a1">
<SCRIPT LANGUAGE="JavaScript">
<!--
function hah(para)
{
 alert(para)
}
a1.onclick=function()
{
 hah('canshu ')
}
//a1.attachEvent("onclick",function(){hah('参数')});
//-->
</SCRIPT>//

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<

上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 下一页

上一篇:Js之软键盘实现(源码)   下一篇:如何优化JavaScript脚本的性能
文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论

   相关文章:
·用javascript+php随机显示图片

   文章评论:(1条)
  
 请留名: 匿名评论   点击查看所有评论 论坛讨论
 

 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。