JavaScript Access´úÂë²Î¿¼
///ÏÂÃæÊǶÔAccessµÄÁ´½Ó
function getCountfromDB() {
//ÒÔµ±Ç°Ò³ÃæÎļþΪ»ù´¡£¬ÕÒµ½ÎļþËùÔڵľø¶Ô·¾¶¡£
var filePath = location.href.substring(0, location.href.indexOf("Cnt.htm"));
var path = filePath + "MyData.mdb";
//È¥µô×Ö·û´®ÖÐ×îÇ°ÃæµÄ"files://"Õâ8¸ö×Ö·û¡£
path = path.substring(8);
var updateCnt = 0;
//Éú³É²éѯºÍ¸üÐÂÓõÄsqlÓï¾ä¡£
var sqlSelCnt = "SELECT COUNT from [COUNT] WHERE ID = 'count'";
var sqlUpdCnt = "UPDATE [COUNT] SET [COUNT] = '";
//½¨Á¢Á¬½Ó£¬²¢Éú³ÉÏà¹Ø×Ö·û´®
var con = new ActiveXObject("ADODB.Connection");
con.Provider = "Microsoft.Jet.OLEDB.4.0";
con.ConnectionString = "Data Source=" + path;
con.open;
//rs¼Ç¼±íµÄ½¨Á¢
var rs = new ActiveXObject("ADODB.Recordset");
rs.open(sqlSelCnt, con);
while (!rs.eof) {
var cnt = rs.Fields("COUNT");
document.write(cnt);
//½«È¡µÃ½á¹û¼Ó1ºó¸üÐÂÊý¾Ý¿â¡£
updateCnt = cnt * 1 + 1;
rs.moveNext;
}
rs.close();
rs = null;
sqlUpdCnt = sqlUpdCnt + updateCnt + "'";
con.execute(sqlUpdCnt);
con.close();
con = null;
}
//ÏÂÃæÊÇÓëÎı¾½¨Á¢ÁªÏµ
function getCountfromTxt() {
var filePath = location.href.substring(0, location.href.indexOf("Cnt.htm"));
var path = filePath + "count.txt";
path = path.substring(8);
var nextCnt = 0;
&
Ïà¹ØÎĵµ£º
<html>
<head>
<mce:script type="text/javascript"><!--
function aaa()
{
alert("oh no");
window.location="http://community.csdn.net/";
}
// --></mce:script>
</head>
<body onload = aaa();>
< ......
±¾ÎÄÒë×Ô£ºhttp://www.codeproject.com/KB/scripting/jsbeginner.aspx
ÔÎÄ£ºJavaScript For Beginners
ÊÊÒ˶ÔÏó£ºJavaScript³õѧÕß¡£
Ŀ¼£º
°üº¬ÓëÒýÈë(Embedding,including)
write ºÍ writeln
Îĵµ¶ÔÏó£¨document object£©
bgColor ºÍ fgColor
ÏûÏ¢¿ò£¨Message Box£©
±äÁ¿£¨Variables ......
// PageLoadʼþ
var onloadMethod = window.onload;
window.onload = window_Load;
function window_Load() {
var i;
var item;
// È«²¿Á¬½ÓµÄʼþ
for (i = 0; i < document.links.length; i ++) {
item = document.links[i]
Object.Aspect.around(item, "onclick", checkLoading);
}
// È«²¿°´Å ......
ÔÚJavaScriptÖÐ×Ö·û´®×éºÏÏà¼Ó£¬´ó¼ÒÒ»°ãÖ±½ÓÓÃ+Æ´½ÓÆðÀ´.ÀýÈç:
for(i=0; i<len; i++){
if(zdname != ""){
zdname += "#" + trNode.children.item(i).getAttribute("busPath");
}else{
zdname = trNode.children.item(i).getAttribute("busPath");
  ......
var arr=['a','b','c'];
¡¡¡¡ÈôҪɾ³ýÆäÖеÄ'b',ÓÐÁ½ÖÖ·½·¨£º
¡¡¡¡1.delete·½·¨:delete arr[1]
¡¡¡¡ÕâÖÖ·½Ê½Êý×鳤¶È²»±ä,´Ëʱarr[1]±äΪundefinedÁË,µ«ÊÇÒ²Óкô¦ÔÀ´Êý×éµÄË÷ÒýÒ²±£³Ö²»±ä,´ËʱҪ±éÀúÊý×éÔªËØ¿ÉÒÔ²ÅÓÃ
¡¡¡¡for(index in arr)& ......