JS(javascript)²Ù×÷Êý¾Ý¿â
//°ÑÊý¾ÝдÈëÊý¾Ý¿â
function
res(){
//»ñÈ¡ÊäÈëÖµ(mynameºÍmymailÊÇÁ½¸öÎı¾¿òµÄid)
var
uname = document.getElementById("myname"
).value;
var
umail = document.getElementById("mymail"
).value;
//Êý¾Ý¿âÁ¬½Ó¶ÔÏó
var
con = new
ActiveXObject("ADODB.Connection"
);
//Á¬½Ó×Ö·û´®
var
str = "DRIVER={SQL SERVER}
;SERVER=(local);uid=sa;pwd=123456;database=xslt"
;
//´ò¿ªÊý¾ÝÔ´
con.Open(str);
//sqlÓï¾ä
var
sql = "insert into xslt(name,mail) values('"
+ uname + "','"
+ umail + "')"
;
try
{
//Ö´ÐÐsqlÓï¾ä
con.Execute(sql);
//¹Ø±ÕÁ¬½Ó
con.Close();
//תÏò³É¹¦Ò³Ãæ
window.location.href = "http://www.aspxcs.net/";
}
catch
(e){
alert(e);
}
Ïà¹ØÎĵµ£º
1¡¢¶ÔÏóµÄ¼Ì³Ð£¬Ò»°ãµÄ×ö·¨ÊǸ´ÖÆ£ºObject.extend
prototype.jsµÄʵÏÖ·½Ê½ÊÇ£º
Object.extend = function(destination, source){
for (property in source) {
destination[property] = source[property];
}
return destination;
......
ÔÚjsÖУ¬Ã¿¸ö¶ÔÏó¶¼ÓÐÒ»¸öprototypeÊôÐÔ£º·µ»Ø¶ÔÏóÀàÐÍÔÐ͵ÄÒýÓ᣺ÜÞÖ¿Ú£¡Ï°Óï“ÒÀºù«»Æ°”£¬ÕâÀïµÄºù«¾ÍÊÇÔÐÍ£¬ÄÇô“Æ°.prototype” ·µ»ØµÄ¾ÍÊǺù«£¬»òÕß“Æ°.prototype= new ºù«()”¡£
prototypeµÄÓÃ;£º
¼Ì³Ð
ÓÐÒ»¸ö¶ÔÏó££×ÓÀࣺ
function ×ÓÀà() {
this.lastname = ......
¶þÊ®¡¢Bookmarklet
1¡¢Ê²Ã´ÊÇBookmarklet£¿£¨What's a Bookmarklet?£©
Q£ºÊ²Ã´ÊÇBookmarklet£¿
A£ºBookmarkletÊÇÕû¸ö¶¼±»°üº¬ÔÚ³¬Á´½ÓURLÖеÄһС¶ÎJavaScript³ÌÐò¡££¨JavaScript URL¾ÍÊÇÕâ¸öÑù×Ó£º<a href="javascript:the code goes here">¡££©¶àÊýä¯ÀÀÆ÷ÔÊÐíÓû§Ìí¼ÓÕâЩJavaScript URLÊéÇ©£¬¾ÍÏñÌí¼ÓÆäËû³¬Á´½ ......
¶¨ÒåÓëÓ÷¨
The prototype property allows you to add properties and methods to an
object.
prototypeÊôÐÔÔÊÐíÄãÏòÒ»¸ö¶ÔÏóÌí¼ÓÊôÐԺͷ½·¨
Syntax
Óï·¨
object.prototype.name=value
Example 1
ʵÀý
In this example we will show how to use the prototype property to add a
property to an object:
ÔÚÏÂ ......
¶þ¡¢¶¯Ì¬¸ø±í²åÈëÐУº
function addRow(){
//¶¯Ì¬²åÈëÒ»ÐÐ
var oRow1=mediaMes.insertRow(mediaMes.rows.length);
//ÉèÖÃtrµÄid
oRow1.id="tr"+thisId;
//»ñµÃ±í×ܵÄÐÐÊý
var aRows=mediaMes.rows;
//»ñµÃÐÂÌí¼ÓÐеÄÁм¯ºÏ
var aCells=oRow1. ......