javaScript中的innerText火狐浏览器不支持
这两天的工作中遇到一个有关js的问题,很郁闷遇到js问题,因为没有报错,你根本就不知道自己错在哪里。
其实就是关于“document.getElementById("ss").innerText”的问题,我上网查关于js浏览器的兼容问题,可是都给出的解释是:
“HTML对象获取问题
FireFox
:document
.getElementById
("idName");
ie:document
.idname或者document
.getElementById
("idName").
解决办法:统一使用document
.getElementById
("idName");”
问题是我就是使用的“document
.getElementById
("idName")”,可是FireFox还是不行,后来才查到原来是
FireFox不支持
innerText!
我后来的解决方法就是用“innerHTML”代替“innerText”,然后将取到的内容过滤html的标签。
例:
var obj=document.getElementById("ss").innerHTML;
result=obj.replace(/<.*?>/g,"");
result=result.replace(/ /g,"");
相关文档:
本文来自http://q.yesky.com/group/review-17634017.html,另外还添加一些里面技术的链接。
离线事件(Online and offline events):
https://developer.mozilla.org/En/Online_and_offline_events
https://bug336359.bugzilla.mozilla.org/attachment.cgi?id=220609
http://ejohn.org/blog/offline-events/
postMessage ......
引用地址:http://bbs.syue.com/thread-36034-1-1.html
直接在ie地址栏输入命令,回车,执行js。
这样也可以用来改变和获取元素的值和属性,很实用的。
查看cookie
javascript:alert(document.cookie)
直接编辑cookie
javascript:document.cookie=window.prompt("Linx Edit cookie:",document.cookie);void( ......
1 Add the following code to .aspx
<script>
function fresh() {
{
window.opener.document.getElementById("ControlId").click(); //ControlId -- ......
很多人都向在服务器端调用客户端的函数来操作,也就是在asp中调用javascript脚本中已经定义好的脚本函数。经过研究,发现了一些勉强的方法。
1. 用Response.Write方法写入脚本
比如在你单击按钮后,先操作数据库,完了后显示已经完成,可以在最后想调用的地方写上
Response.Write("<script type='text/javascrip ......
事件源对象
event.srcElement.tagName
event.srcElement.type
捕获释放
event.srcElement.setCapture();
event.srcElement.releaseCapture();
事件按键
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
事件返回值
event.returnValue
鼠标位置
event.x
event.y
窗 ......