经过测试,Opera8 (Opera 9 以下的版本),不支持Form 的属性:enctype 的值为: "text/plain".
以下是抓包:
POST http://www.baidu.com/ HTTP/1.0
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; zh-cn) Opera 8.0
Host: www.baidu.com
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: zh-cn, en
Accept-Charset: gbk, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Proxy-Authorization: Basic bmlja3I6MjAyNzIwbmljaw==
Proxy-Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 62
textarea=a%3Db%0D%0Ac%3Dd%0D%0Ae%3Df&button=%E6%8F%90%E4%BA%A4
POST http://www.baidu.com/ HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Content-Type: text/plain
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; TencentTraveler ; InfoPath.2; .NET CLR 2.0.50727)
Host: www.baidu.com
Content-Length: 39
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: BAIDUID=4FAADCED051C9D783F7C6398B1D52AB3
Proxy-Authorization: Basic bmlja3I6MjAyNzIwbmljaw==
textarea=a=b
c=d
e=f
button=鎻愪氦
POST / HTTP/1.1
Host: www.baidu.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Accept: application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: BAIDUID=1AFCAA63A05948B65D2A5BACC30A5BFC
Proxy-Authorization: Basic bmlja3I6MjAyNzIwbmljaw==
Content-Type: text/plain
Content-Length: 33
textarea=a=b
c=d
e=f
button=肖
另外:在Opera 8下,用document.createElement("<form name='f1'>")来生成一个Form的话,实际生成的是:
<<form name='f1'>><</form name='f1'>>
而且不会报错,以至于我写好的代码工作出现问题:
if(!($.$c instanceof Function)) $.$c = function(tag,name){
try{
if(typeof name == "string")
return d_.createElement("<" + tag + " name='" + name + "'>");
else
return d_.createElement(tag);
}catch(e){
return d_.createElement(tag);
}
}
还有,在设置属性的时候,Opera 8 必须用setAttribute,最BT的是:
div_.style.cssText = "width:0px;height:0px;overflow:hidden";//Can not remove it,it for IE
div_.setAttribute("style","width:0px;height:0px;overflow:hidden");//For Opera 8
如果只写上面一句的话,在opera 8下,div_就没有style属性!
汗。。。
以上所述问题在 Opera 9下不存在。