??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产成人二区,国产精品18久久久,精品国产乱码久久久久久88av http://www.aygfsteel.com/gen-sky/archive/2011/04/14/348278.html星期?/dc:creator>星期?/author>Thu, 14 Apr 2011 03:01:00 GMT http://www.aygfsteel.com/gen-sky/archive/2011/04/14/348278.html http://www.aygfsteel.com/gen-sky/comments/348278.html http://www.aygfsteel.com/gen-sky/archive/2011/04/14/348278.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/348278.html http://www.aygfsteel.com/gen-sky/services/trackbacks/348278.html
function base64encode(str) { // base64加密
var base64EncodeChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ " ;
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0 ;
out = "" ;
while (i < len) {
c1 = str.charCodeAt(i ++ ) & 0xff ;
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2 );
out += base64EncodeChars.charAt((c1 & 0x3 ) << 4 );
out += " == " ;
break ;
}
c2 = str.charCodeAt(i ++ );
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2 );
out += base64EncodeChars.charAt(((c1 & 0x3 ) << 4 ) | ((c2 & 0xF0 ) >> 4 ));
out += base64EncodeChars.charAt((c2 & 0xF ) << 2 );
out += " = " ;
break ;
}
c3 = str.charCodeAt(i ++ );
out += base64EncodeChars.charAt(c1 >> 2 );
out += base64EncodeChars.charAt(((c1 & 0x3 ) << 4 ) | ((c2 & 0xF0 ) >> 4 ));
out += base64EncodeChars.charAt(((c2 & 0xF ) << 2 ) | ((c3 & 0xC0 ) >> 6 ));
out += base64EncodeChars.charAt(c3 & 0x3F );
}
return out;
}
function base64decode(str) { // base64解密
var base64DecodeChars = new Array(
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 62 , - 1 , - 1 , - 1 , 63 ,
52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 ,
15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , - 1 , - 1 , - 1 , - 1 , - 1 ,
- 1 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 ,
41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , - 1 , - 1 , - 1 , - 1 , - 1 );
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0 ;
out = "" ;
while (i < len) {
do {
c1 = base64DecodeChars[str.charCodeAt(i ++ ) & 0xff ];
} while (i < len && c1 == - 1 );
if (c1 == - 1 ) break ;
do {
c2 = base64DecodeChars[str.charCodeAt(i ++ ) & 0xff ];
} while (i < len && c2 == - 1 );
if (c2 == - 1 ) break ;
out += String.fromCharCode((c1 << 2 ) | ((c2 & 0x30 ) >> 4 ));
do {
c3 = str.charCodeAt(i ++ ) & 0xff ;
if (c3 == 61 ) return out;
c3 = base64DecodeChars[c3];
} while (i < len && c3 == - 1 );
if (c3 == - 1 ) break ;
out += String.fromCharCode(((c2 & 0XF ) << 4 ) | ((c3 & 0x3C ) >> 2 ));
do {
c4 = str.charCodeAt(i ++ ) & 0xff ;
if (c4 == 61 ) return out;
c4 = base64DecodeChars[c4];
} while (i < len && c4 == - 1 );
if (c4 == - 1 ) break ;
out += String.fromCharCode(((c3 & 0x03 ) << 6 ) | c4);
}
return out;
}
]]>在服务器端判断request来自Ajaxh(异步)q是传统h(同步) http://www.aygfsteel.com/gen-sky/archive/2010/04/29/319692.html星期?/dc:creator>星期?/author>Thu, 29 Apr 2010 07:56:00 GMT http://www.aygfsteel.com/gen-sky/archive/2010/04/29/319692.html http://www.aygfsteel.com/gen-sky/comments/319692.html http://www.aygfsteel.com/gen-sky/archive/2010/04/29/319692.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/319692.html http://www.aygfsteel.com/gen-sky/services/trackbacks/319692.html http://holdbelief.javaeye.com/blog/528114
在服务器端判?span style="background-color: #aaffaa;">request来自Ajaxh(异步)q是传统h(同步)Q?/p>
两种h在请求的Header不同QAjax 异步h比传l的同步h多了一个头参数
1、传l同步请求参?/p>
accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
accept-charset gb2312,utf-8;q=0.7,*;q=0.7
accept-encoding gzip,deflate
accept-language zh-cn,zh;q=0.5
cache-control max-age=0
connection keep-alive
cookie JSESSIONID=1A3BED3F593EA9747C9FDA16D309AF6B
host 192.168.101.72:8080
keep-alive 300
referer http://192.168.101.72:8080/htfsweb/spring_security_login
user-agent Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)
2、Ajax 异步h方式
accept */*
accept-language zh-cn
referer http://192.168.101.72:8080/scm/?token=3b194bff23bf6acecea5661ac8e14c51
x-requested-with XMLHttpRequest
content-type application/x-www-form-urlencoded,text/javascript
accept-encoding gzip, deflate
user-agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; QQDownload 598; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; CIBA; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)
host 192.168.101.72:8080
content-length 233
connection Keep-Alive
cache-control no-cache
cookie CSS=undefined; JSESSIONID=1B9AC25036290F7FB6823CCE1A24E541
可以看到 Ajax h多了?x-requested-with Q可以利用它Q?span style="color: #990066;">request .getHeader("x-requested-with"); ?nullQ则Zl同步请求,?XMLHttpRequestQ则?Ajax 异步h?/span>
]]> [转] js 数组 ?/title> http://www.aygfsteel.com/gen-sky/archive/2009/08/27/292786.html星期?/dc:creator>星期?/author>Thu, 27 Aug 2009 03:25:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/08/27/292786.html http://www.aygfsteel.com/gen-sky/comments/292786.html http://www.aygfsteel.com/gen-sky/archive/2009/08/27/292786.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/292786.html http://www.aygfsteel.com/gen-sky/services/trackbacks/292786.html 转自: http://zhidao.baidu.com/question/42679804.html 有空研究
|上看到一个老前辈写q这D늨序,讨论JS数组的检索速度Q但我发C个问题,LQ?
<input id="count" value="50000" size="7" maxlength="6">
<input type="button" value="数组初始? onclick="txt.innerHTML = array_init()"><br>
<input type="button" value="传统循环" onclick="txt.innerHTML += method_for()">
<input type="button" value="正则匚w" onclick="txt.innerHTML += method_regexp()">
<div id="txt"></div>
<SCRIPT LANGUAGE="JavaScript">
var txt = document.getElementById("txt");
var a = new Array();
function array_init()
{
var n = parseInt(document.getElementById("count").value);
a.length = 0;
for(var i=0; i<n; i++)
{
a[i] = Math.random() +"";
}
return "数组长度Q?+ n;
}
function method_for()
{
var n = a.length;
var begin = new Date().getTime();
var b = new Array();
for(var i=0; i<n; i++)
{
if(a[i].indexOf("0.9999")==0)
{
b[b.length] = a[i];
}
}
return ("<br>传统循环法耗时 "+ (new Date().getTime() - begin)
+" 毫秒Q检索的l果Q?lt;strong title='"+ b.join("
")
+"'>索到 "+ b.length +" 个记录!</strong>");
}
function method_regexp()
{
var begin = new Date().getTime();
var b = new Array();
var s = a.join("\x0f");
var r = new RegExp().compile("0\\.9999\\d+", "g");
b = s.match(r); s = "";
return ("<br>正则匚w法耗时 "+ (new Date().getTime() - begin)
+" 毫秒Q检索的l果Q?lt;strong title='"+ b.join("
")
+"'>索到 "+ b.length +" 个记录!</strong>");
}
</SCRIPT>
问题Q?
当在IE中运行的时候,正则索很?
当在FireFox中运行的时候,l果相反Q遍历数l很快,而正则还没有在IE中遍历数l的Ҏ?
朋友们有兴趣的试试,讨论一下IE中和FireFox中遍历数l和正则各是怎么一回事
]]> js 优化|址 http://www.aygfsteel.com/gen-sky/archive/2009/08/26/292616.html星期?/dc:creator>星期?/author>Wed, 26 Aug 2009 03:11:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/08/26/292616.html http://www.aygfsteel.com/gen-sky/comments/292616.html http://www.aygfsteel.com/gen-sky/archive/2009/08/26/292616.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/292616.html http://www.aygfsteel.com/gen-sky/services/trackbacks/292616.html
js 优化 Q十个方?: http://liuleigang.javaeye.com/blog/376940
javascript 代码优化 (春风不识字,何故乱抄? http://www.javaeye.com/topic/266962
javascipt 应用Q?http://nomad.javaeye.com/blog/205616
再议《JavaScript代码优化一例?nbsp; http://blog.csdn.net/aimingoo/archive/2007/08/29/1764224.aspx
javascript 代码优化一例(文) http://prowyh.spaces.live.com/blog/cns!EAAA8AB356F88EA0!425.entry
]]> [转] 关于 insertAdjacentHTML insertAdjacentText http://www.aygfsteel.com/gen-sky/archive/2009/07/09/286032.html星期?/dc:creator>星期?/author>Thu, 09 Jul 2009 02:37:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/07/09/286032.html http://www.aygfsteel.com/gen-sky/comments/286032.html http://www.aygfsteel.com/gen-sky/archive/2009/07/09/286032.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/286032.html http://www.aygfsteel.com/gen-sky/services/trackbacks/286032.html
1 dhtml内容(insertAdjacentHTML和insertAdjacentText)
2 dhtml提供了两个方法来q行dQinsertAdjacentHTML和insertAdjacentText
3 insertAdjacentHTMLҎQ在指定的地Ҏ入html标签语句?br />
4 原型QinsertAdjacentHTML(swhere,stext)
5 参数Q?br />
6 swhere:指定插入html标签语句的地方,有四U值可以用Q?br />
7 1.beforeBegin:插入到标{ּ始前
8 2.afterBegin:插入到标{ּ始标记后
9 3.beforeEnd:插入到标{束标记前
10 4.afterEnd:插入到标{束标记后
11 stext:要插入的内容
12 例:var sHTML="< input type =button onclick =" + " go2()" + " value ='Click Me' >< BR > "
13 var sScript='< SCRIPT DEFER > '
14 sScript = sScript + ' function go2() { alert( " Hello from inserted script. " ) } '
15 sScript = sScript + ' </ script' + ' > ';
16 ScriptDiv.insertAdjacentHTML("afterBegin",sHTML + sScript);
17 在html正文中加入一行:
18 < DIV ID ="ScriptDiv" ></ Div >
19 最l变成:
20 < DIV ID ="ScriptDiv" >
21 < input type =button onclick =go2() value ='Click Me' >< BR >
22 < SCRIPT DEFER >
23 function go2() {alert( " Hello from inserted sctipt. " )} '
24 </ script >
25 </ DIV >
26 insertAdjacentTextҎ与insertAdjacentHTMLҎcMQ只不过只能插入U文本,参数相同
27 trackback:http://gmfzh.bokee.com/3680267.html
28
29
30 Ҏ名称QinsertHtml(where,el,html)
31
32 参数介绍Q?br />
33 whereQ插入位|。包括beforeBegin,beforeEnd,afterBegin,afterEnd?br />
34 elQ用于参照插入位|的html元素对象
35 htmlQ要插入的html代码
36
37 源码如下Q?br />
38 < script type ="text/javascript" >
39 <!--
40 function insertHtml(where, el, html) {
41 where = where.toLowerCase();
42 if (el.insertAdjacentHTML) {
43 switch (where) {
44 case " beforebegin " :
45 el.insertAdjacentHTML('BeforeBegin', html);
46 return el.previousSibling;
47 case " afterbegin " :
48 el.insertAdjacentHTML('AfterBegin', html);
49 return el.firstChild;
50 case " beforeend " :
51 el.insertAdjacentHTML('BeforeEnd', html);
52 return el.lastChild;
53 case " afterend " :
54 el.insertAdjacentHTML('AfterEnd', html);
55 return el.nextSibling;
56 }
57 throw 'Illegal insertion point -> " ' + where + ' " ';
58 }
59 var range = el.ownerDocument.createRange();
60 var frag;
61 switch (where) {
62 case " beforebegin " :
63 range.setStartBefore(el);
64 frag = range.createContextualFragment(html);
65 el.parentNode.insertBefore(frag, el);
66 return el.previousSibling;
67 case " afterbegin " :
68 if (el.firstChild) {
69 range.setStartBefore(el.firstChild);
70 frag = range.createContextualFragment(html);
71 el.insertBefore(frag, el.firstChild);
72 return el.firstChild;
73 }else {
74 el.innerHTML = html;
75 return el.firstChild;
76 }
77 case " beforeend " :
78 if (el.lastChild) {
79 range.setStartAfter(el.lastChild);
80 frag = range.createContextualFragment(html);
81 el.appendChild(frag);
82 return el.lastChild;
83 }else {
84 el.innerHTML = html;
85 return el.lastChild;
86 }
87 case " afterend " :
88 range.setStartAfter(el);
89 frag = range.createContextualFragment(html);
90 el.parentNode.insertBefore(frag, el.nextSibling);
91 return el.nextSibling;
92 }
93 throw 'Illegal insertion point -> " ' + where + ' " ';
94 }
95
96 trackback: http:// www.aygfsteel.com/Scott/archive/2007/08/30/141449.html
97
]]>[转] javascript的prototypel承 http://www.aygfsteel.com/gen-sky/archive/2009/07/08/285950.html星期?/dc:creator>星期?/author>Wed, 08 Jul 2009 06:04:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/07/08/285950.html http://www.aygfsteel.com/gen-sky/comments/285950.html http://www.aygfsteel.com/gen-sky/archive/2009/07/08/285950.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/285950.html http://www.aygfsteel.com/gen-sky/services/trackbacks/285950.html
基本的用?把ClassA的一个实例赋值给ClassB ClassBq承了ClassA的所有属?br />
< script >
function ClassA()
{
this .a = 'a';
}
function ClassB()
{
this .b = 'b';
}
ClassB.prototype= new ClassA();
var objB = new ClassB();
for ( var p in objB)document.write(p + " <br> " );
</ script >
从原型承理论的角度去考虑 js的原型承是引用原型 不是复制原型
所?修改原型会导致所有B的实例的变化
< script >
function ClassA()
{
this .a = 'a';
}
function ClassB()
{
this .b = 'b';
}
ClassB.prototype= new ClassA();
var objB = new ClassB();
alert(objB.a);
ClassB.prototype.a = 'changed !! ';
alert(objB.a);
</ script >
然?子类对象的写操作只访问子cd象中成员 它们之间不会互相影响
因此 写是写子c?Ld型(如果子类中没有的话)
< script >
function ClassA()
{
this .a = 'a';
}
function ClassB()
{
this .b = 'b';
}
ClassB.prototype= new ClassA();
var objB1 = new ClassB();
var objB2 = new ClassB();
objB1.a = ' !!! ';
alert(objB1.a);
alert(objB2.a);
</ script >
每个子类对象都执有同一个原型的引用 所以子cd象中的原型成员实际是同一?br />
< script >
function ClassA()
{
this .a = function () {alert();} ;
}
function ClassB()
{
this .b = function () {alert();} ;
}
ClassB.prototype= new ClassA();
var objB1 = new ClassB();
var objB2 = new ClassB();
alert(objB1.a == objB2.a);
alert(objB1.b == objB2.b);
</ script >
构造子cL 原型的构造函C会被执行
< script >
function ClassA()
{
alert( " a " );
this .a = function () {alert();} ;
}
function ClassB()
{
alert( " b " );
this .b = function () {alert();} ;
}
ClassB.prototype= new ClassA();
var objB1 = new ClassB();
var objB2 = new ClassB();
</ script >
接下来是致命的,在子cd象中讉K原型的成员对象:
< script >
function ClassA()
{
this .a = [];
}
function ClassB()
{
this .b = function () {alert();} ;
}
ClassB.prototype= new ClassA();
var objB1 = new ClassB();
var objB2 = new ClassB();
objB1.a.push( 1 , 2 , 3 );
alert(objB2.a);
// 所有b的实例中的a成员全都变了Q!
</ script >
所?在prototypel承?原型cM不能有成员对象! 所有成员必L值类型数据(string也可以)
用prototypel承有执行效率高Q不会浪费内存,为父cd态添|方法后子类中马上可见等的优炏V?br />
我就非常喜欢用prototypel承?br />
prototypel承是通过把子cȝ原型对象QprototypeQ设|成父类的一个实例来q行l承的?br />
只简单的q样讄l承的确如楼L_有不缺炏Vȝ来说有四个缺点:
~点一Q父cȝ构造函C是像JAVA中那样在l子c进行实例化时执行的Q而是在设|承的时候执行的Qƈ且只执行一ơ。这往往不是我们希望的,特别是父cȝ构造函C有一些特D操作的情况下?br />
~点二:׃父类的构造函C是在子类q行实例化时执行Q在父类的构造函C讄的成员变量到了子cM成了所有实例对象公有的公共变量。由?
JavaScript中承只发生?#8220;获取”属性的值时Q对于属性的值是StringQNumber和Booleanq些数据本n不能被修改的cd时没?
什么媄响。但是Array和Objectcd׃有问题?br />
~点三:如果父类的构造函数需要参敎ͼ我们没有办法了?br />
~点四:子类原本的原型对象被替换了,子类本n的constructor属性就没有了。在cȝ实例取它的constructor属性时Q取得的是从父类中承的constructor属性,从而constructor的值是父类而不是子cR?br />
我也曄Zq四个缺点头DQ于是对prototypel承q行攚w?br />
我试了几U方法,下面是我觉得最好的一U。我把它写成Function对象的一个方法,q样用的时候方ѝ方法如下:
// cȝl承-h?/span>
Function.prototype.Extends = function (parentClass)
{
var Bs = new Function();
Bs.prototype = parentClass.prototype;
this .prototype = new Bs();
this .prototype.Super = parentClass;
this .prototype.constructor = this ;
}
]]> javascript 字符串比?/title> http://www.aygfsteel.com/gen-sky/archive/2009/07/03/285381.html星期?/dc:creator>星期?/author>Fri, 03 Jul 2009 09:04:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/07/03/285381.html http://www.aygfsteel.com/gen-sky/comments/285381.html http://www.aygfsteel.com/gen-sky/archive/2009/07/03/285381.html#Feedback 1 http://www.aygfsteel.com/gen-sky/comments/commentRss/285381.html http://www.aygfsteel.com/gen-sky/services/trackbacks/285381.html
没有专门的比较方法,只用 "==" q行比较?br />
有特D情c?br />
当比?undefined Ӟ会出错?br />
<script language="javascript">
var a;
alert(a);
alert(a == 'undefined');
</script>
q回l果Q?br />
undefined
false
那么应该怎么办呢Q?br />
q样比较
<script language="javascript">
var a;
alert(a);
alert(a+'.' == 'undefined.');
</script>
q个时候便q回 true;
]]> JScript 代码判断上传囄寸 http://www.aygfsteel.com/gen-sky/archive/2009/06/26/241717.html星期?/dc:creator>星期?/author>Fri, 26 Jun 2009 10:21:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/06/26/241717.html <HTML>
< BODY >
< script >
var img = null ;
function s()
{
if (img)img.removeNode( true );
img = document.createElement( " img " );
img.style.position = " absolute " ;
img.style.visibility = " hidden " ;
img.attachEvent( " onreadystatechange " ,orsc);
img.attachEvent( " onerror " ,oe);
document.body.insertAdjacentElement( " beforeend " ,img);
img.src = inp.value;
}
function oe()
{
alert( " cant load img " );
}
function orsc()
{
if (img.readyState != " complete " ) return false ;
alert( " 囄大小Q?/span>" + img.offsetWidth + " X " + img.offsetHeight);
alert( " 囄寸Q?/span>" + img.fileSize);
}
</ script >
< input id = inp type = " file " >
< br >
< button onclick = " s() " > Test </ button >
</ BODY >
</ HTML >
]]> HTML 技?/title> http://www.aygfsteel.com/gen-sky/archive/2009/06/26/241382.html星期?/dc:creator>星期?/author>Fri, 26 Jun 2009 10:13:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/06/26/241382.html http://www.aygfsteel.com/gen-sky/comments/241382.html http://www.aygfsteel.com/gen-sky/archive/2009/06/26/241382.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/241382.html http://www.aygfsteel.com/gen-sky/services/trackbacks/241382.html
< input type ="text" name =" isa agencyCo" size ="30" d bled ="disabled" />
]]> request ?requestScope 区别 http://www.aygfsteel.com/gen-sky/archive/2009/06/25/284148.html星期?/dc:creator>星期?/author>Thu, 25 Jun 2009 09:43:00 GMT http://www.aygfsteel.com/gen-sky/archive/2009/06/25/284148.html http://www.aygfsteel.com/gen-sky/comments/284148.html http://www.aygfsteel.com/gen-sky/archive/2009/06/25/284148.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/284148.html http://www.aygfsteel.com/gen-sky/services/trackbacks/284148.html
requestScope是一个定义, 表明一个httph的整个声明周期,它只是一个定义而已Q不是一个对象?EL中你可以在这个周期中攄、获取对象。(当然Q其实真正的操作也是针对request对象的)?比如${requestScope.a.b}Q其实就是要表明我告诉jsp要到requestScopeq个声明周期中获取对象a.b.而背后的实现是从request.getAttribute("a"Q然后根据表辑ּ得到相应的a.b对象?
不一?
]]> html select 另类用法 http://www.aygfsteel.com/gen-sky/archive/2008/12/12/246022.html星期?/dc:creator>星期?/author>Fri, 12 Dec 2008 10:34:00 GMT http://www.aygfsteel.com/gen-sky/archive/2008/12/12/246022.html http://www.aygfsteel.com/gen-sky/comments/246022.html http://www.aygfsteel.com/gen-sky/archive/2008/12/12/246022.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/246022.html http://www.aygfsteel.com/gen-sky/services/trackbacks/246022.html
<head>
<script language="javascript">
function number(){
var obj = document.getElementById("mySelect");
/*
for(var i=0;i<obj.options.length;i++){
if(obj.options[i].value=='我的包包'){
obj.selectedIndex = i;
}
}
*/
obj.value='我的包包';
//obj.options[obj.selectedIndex] = Option("我的吃吃","4");//在当前选中的那个的g改变
//obj.selectedIndex = 3;
//obj.options.add(new Option("我的吃吃","4"));//再添加一个option
//alert(obj.selectedIndex);//昄序号Qoption自己讄?br />
//obj.options[obj.selectedIndex].text = "我的吃吃";//更改?br />
//obj.remove(obj.selectedIndex);//删除功能
}
</script>
</head>
<body>
<select id="mySelect">
<option value="我的包包">我的包包</option>
<option value="我的本本">我的本本</option>
<option value="我的Ҏa">我的Ҏa</option>
<option value="我的担子">我的担子</option>
</select>
<input type="button" name="button" value="查看l果" onclick="number();">
</body>
</html>
/*
* 使下拉列表的内容与选定的条件相W?nbsp;
*/
function chooseSelect(id,value){
var select = document.getElementById(id);
var options = select.options;
// 循环变量,扑ֈ适合的数?br />
for (var i = 0; i < options.length; i += 1) {
if(options[i].value == value){
options[i].selected = true;
}
}
}
]]> [转]javascript HTML DOM option对象ȝ http://www.aygfsteel.com/gen-sky/archive/2008/12/12/246019.html星期?/dc:creator>星期?/author>Fri, 12 Dec 2008 10:20:00 GMT http://www.aygfsteel.com/gen-sky/archive/2008/12/12/246019.html http://www.aygfsteel.com/gen-sky/comments/246019.html http://www.aygfsteel.com/gen-sky/archive/2008/12/12/246019.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/246019.html http://www.aygfsteel.com/gen-sky/services/trackbacks/246019.html javascript HTML DOM
option对象ȝ
DATA:2008-4-13 18:00 AUTHOR:renxian
ADDR:beijing
一基础理解:
var e = document.getElementById("selectId");
e. options= new O ption("文本","?)
;
//创徏一个option对象,卛_<select>标签中创Z个或多个<option
value="?>文本</option>
//options是个数组,里面可以存放多个<option
value="?>文本</option>q样的标{?/font>
1:options[ ]数组的属?
length属?--------长度属?/font>
selectedIndex属?-------当前被选中的框中的文本的烦引?此烦引值是内存自动分配?0,1,2,3.....)对应(W一个文本?W二个文本?W三个文本?W四个文本?.........)
2:单个option的属?/font>(---obj.options[obj.selecedIndex]是指定的某个<option>标签,是一?--)
text属?--------q回/指定 文本
value属?-----q回/指定 |?lt;options value="...">一致?/font>
index属?------q回下标,
selected 属?------q回/指定该对象是否被选中.通过指定 true 或?
falseQ可以动态的改变选中?/font>
defaultSelected 属?----q回该对象默认是否被选中。true / false?/font>
3:option的方?/font>
增加一?lt;option>标签----- obj.options.add(new("文本","?));<?gt;
删除一?lt;option>标签-----obj.options.remove(obj.selectedIndex )<?gt;
获得一?lt;option>标签的文?----obj.options[obj.selectedIndex].text<?gt;
修改一?lt;option>标签的?----obj.options[obj.selectedIndex]=new
Option("新文?,"新?)<?gt;
删除所?lt;option>标签-----obj.options.length = 0
获得一?lt;option>标签的?----obj.options[obj.selectedIndex].value
注意:
a:上面的写的是如这L型的Ҏobj.options.function()而不写obj.funciton,是因Zؓ了考虑在IE和FF
下的兼容,如obj.add()只能在IE中有?
b:obj.option中的option不需要大?new Option中的Option需要大?/font>
?应用
<html>
<head>
<script
language="javascript">
function number(){
var obj =
document.getElementById("mySelect");
//obj.options[obj.selectedIndex] =
new Option("我的吃吃","4");//在当前选中的那个的g改变
//obj.options.add(new
Option("我的吃吃","4"));再添加一个option
//alert(obj.selectedIndex);//昄序号Qoption自己讄?br />
//obj.options[obj.selectedIndex].text = "我的吃吃";更改?br />
//obj.remove(obj.selectedIndex);删除功能
}
</script>
</head>
<body>
<select
id="mySelect">
<option>我的包包</option>
<option>我的本本</option>
<option>我的Ҏa</option>
<option>我的担子</option>
</select>
<input type="button"
name="button" value="查看l果"
onclick="number();">
</body>
</html>
]]> [ ?] form的onsubmit属? http://www.aygfsteel.com/gen-sky/archive/2008/12/03/244091.html星期?/dc:creator>星期?/author>Wed, 03 Dec 2008 02:56:00 GMT http://www.aygfsteel.com/gen-sky/archive/2008/12/03/244091.html http://www.aygfsteel.com/gen-sky/comments/244091.html http://www.aygfsteel.com/gen-sky/archive/2008/12/03/244091.html#Feedback 0 http://www.aygfsteel.com/gen-sky/comments/commentRss/244091.html http://www.aygfsteel.com/gen-sky/services/trackbacks/244091.html ]]> showModalDialogq回值的问题Q?/title> http://www.aygfsteel.com/gen-sky/archive/2008/12/02/243867.html星期?/dc:creator>星期?/author>Tue, 02 Dec 2008 02:51:00 GMT http://www.aygfsteel.com/gen-sky/archive/2008/12/02/243867.html http://www.aygfsteel.com/gen-sky/comments/243867.html http://www.aygfsteel.com/gen-sky/archive/2008/12/02/243867.html#Feedback 1 http://www.aygfsteel.com/gen-sky/comments/commentRss/243867.html http://www.aygfsteel.com/gen-sky/services/trackbacks/243867.html
1. show.html
<script language="javascript">
var rv = showModalDialog("sm.html");
alert(rv.length);
alert(rv[0] + ":" + rv[1]);
</script>
2. sm.html:
<script language="javascript">
function closeWin()
{
var rt = new Array(2);
rt[0] = "hello";
rt[1] = "world";
window.returnValue = rt;
window.close();
}
</script>
<input type="button" value="close" onclick="closeWin()">
下面是对只有两个q回值的处理Ҏ?
Ҏ一Q利用returnValue
1、在WEB对话框中Q设returnValue="q回?"+"|"+"q回?"(注意q回值总长度不能超q?096个字?
2、在主页面中Q?
retvar=showModalDialog("test.htm");
ret=retvar.split(/|/g);
//以下是检返回值情?
alert(ret[0]+""n"n"+ret[1]);
Ҏ二:利用l主面中的变量赋值的Ҏ
1、在主页面中预先定义两个变量x1,x2,卻I
var x1,x2;
2、在web对话框中Q给主页面赋倹{?
parent.x1="1234567890";
parent.x2="xyz";
]]>
վ֩ģ壺
|
|
|
ǿ |
˳ƽ |
|
Դ |
|
ն |
|
ƽ |
Ȫ |
̨ |
|
ɳ |
ɽ |
Ϊ |
ƽ |
˼ |
|
|
|
|
|
˫Ѽɽ |
ֹ |
Ȫ |
˳ |
߷ |
|
ȫ |
|
°Ͷ |
ǭ |
|
괨 |
ľ |
|
ֹ |
|
Դ |