- 浏览: 390288 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
there is a known issue that if you have a form with several inupt elements, and those elemnt happens to have specific id or names then the elements becomes the expando attribute of the form element.
e.g..
<body> <form id="form" action="/"> <input type="text" id="id"/> <input type="text" name="action"/> </form> </body>
in this example, if you do
form.id, then it return the DOM element, and if you do form.action, it returns another input element.
so to work around, this, there is a method which is called getAttributeNode. please see the following code which first check the attribute node then check to see if there there is attribute with that name (the expando is equivalent of getAttribute)
/************************************** *@Name: ieformexpando.js *@Summary * due to some reason, the IE will treat some input element as attribute to the form object if the nput elements happens to have a specific name or ID * * * <form id="form" action="/"> * <input type="text" id="id"/> * <input type="text" name="action"/> * </form> ***************************************/ function attr(elem, name) { if (elem.nodeName.toUpperCase() === "form" && elem.getAttributeNode(name)) { return elem.getAttributeNode(name).nodeValue; } else { return elem.getAttribute(name); } }
and below is the code that test the code above.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- ieformexpando.html --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" src="../unit.js"></script> <script type="text/javascript" src="ieformexpando.js"></script> <script type="text/javascript"> window.onload = function () { test("test IE expando ", function () { var form = document.getElementById("form"); // both are 'form' and '/' accordingly // alert(attr(form, "id")); // alert(attr(form, "action")); assert(attr(form, "id") === 'form', "attr return the attribute node rather that the attribute where is faked by the element"); assert(attr(form, "action") === '/', "attr return the attribute node rather that the attribute where is faked by the element"); }); }; </script> <style type="text/css"> #results li.pass { color:Green } #results li.fail { color:red} </style> </head> <body> <ul id="results" /> <form id="form" action="/"> <input type="text" id="id"/> <input type="text" name="action"/> </form> </body> </html>
发表评论
-
javascript - trick to cross browser DOM ready event
2012-08-24 08:23 903the "ready" event ... -
javascript - trick to simulate mouseenter and mouseleave
2012-08-23 08:31 2229Previously we discussed javasc ... -
javascript - trick to simulate the change event
2012-08-22 08:51 1616In the previous discussion a ... -
javascript - trick to simulate bubbling submit event
2012-08-22 08:03 885In the previous discussion abou ... -
javascript - trick to implement bubbling submit event
2012-08-23 07:55 674Following up to the javascrip ... -
javascript - trick to detect bubbling supportability
2012-08-20 22:22 934Event delegation is oe of the b ... -
javascript - trigger event and custom events
2012-08-20 21:58 2048In the previous post - javascri ... -
javascript - trick to handlers management
2012-08-20 08:19 996We have discussed "javascr ... -
javascript - trick to centralized store
2012-08-20 07:52 788For a number of reasons it's ... -
javascript - trick to fix the event object
2012-08-20 07:47 851Many browsers, especially In ... -
javascript - tricks to deal with colors
2012-08-15 08:34 745There are a couple of ways to r ... -
javascript - trick to manipulate the opacity
2012-08-15 08:26 745All other browsre may have supp ... -
javascript - trick to test visibility of an element
2012-08-15 08:15 499though there is a visible prope ... -
javascript - trick to get and set height and width
2012-08-15 08:05 525when looking at properties t ... -
javascript - trick to set/get attributes that expects px values
2012-08-16 11:00 497When setting a number into a ... -
javascript - trick to get and set CSS style
2012-08-16 11:00 719while it will not be so much tr ... -
javascript - trick to normalize href for IE
2012-08-16 10:59 510IE is again the only browser th ... -
javascript expando and attributes
2012-08-14 08:15 1013expando is something like this ... -
javascript - trick to getText and setText
2012-08-14 07:40 1108it is not as simple as you thin ... -
javascript - trick/guideline to remove DOM element
2012-08-14 07:00 1160remove an element is not as sim ...
相关推荐
Python-trick,上传的事pdf文档
split file and join write in vb6
语言:python 内容包括:源码、数据集、数据集描述、论文 目的:使用CNN算法在橄榄球比赛中目标检测。 带数据集很好运行,主页有搭建环境过程。主页有更多源码。 数据集描述如下: 在这场比赛中,你的任务是预测球员...
概述 这是Tips-N-Trick,书签等面向公众的文档。
gtg-grind-trick-generator PWA Web应用程序(Node.js,JS,HTML,CSS) Chrome,Safari,Firefox,Edge(Android,iOS,MacOS,Windows) 离线工作Android应用程式使用Google Workbox,Webpack制作
一套针对中文实体识别的BLSTM-CRF解决方案,主要包括:数据处理,模型构建,模型训练,模型测试,服务部署(thrift和flask)两种方式。
Python 提示和技巧 ... git clone https://github.com/plasmashadow/py-trick-book.git 我假设您安装了 ipython 导航到目录并执行 ipython notebook 笔记: 退出间谍活动并自己阅读 或者 保持冷静,加入草帽海贼团
React 21 卡技巧一个演示卡片技巧的React应用程序。动机该项目旨在学习如何使用 React 钩子和进行嵌套的 api 调用。 该项目不再进行。怎么玩记住 21 张卡片中的 1 张后,单击完成。 选择您的卡片所在的 3 堆中的哪一...
语言:English (United States) 该扩展程序重新启用了网页上的复制/粘贴功能,上下文菜单和本机突出显示功能。
Trick-CMCC 利用CMCC公共热点的小漏洞免费上网~~ :) sudo ./conn.sh Notice: 目前只知道我工CMCC有这特色, 其他地区尚不明确 Notice: 脚本适用于使用NetWorkManager网络sds管理工具的系统 Notice: 不必惊讶原理, ...
该扩展程序重新启用网页上的复制/粘贴功能,上下文菜单和本机突出显示功能。 支持语言:English (United States)
Sure, you can submit a form and maybe do a trick here and there with some crafty HTML and CSS coding, but you’re really just playing Weekend at Bernie’s propping up a lifeless web page. Real live ...
Trick
NIO trick and trap NIO,编写高性能Java NIO网络框架
From Feature Space to Primal Space: KPCA and Its Mixture Model,王海贤,,Kernel principal component analysis (KPCA), as a nonlinear extension to PCA via kernel trick, has received great attention for...
机器学习中为什么需要 Kernel Trick 以及 Kernel Trick 的证明。
css-trick css常用的开发技巧
vdr-hattrick是视频磁盘录像机(VDR)的插件。 它显示了在线足球游戏“ hattrick”(http://www.hattrick.org/)提供的实时比赛。
Hattrick球场上座率概算 Hattrick球场上座率概算
NIO陷阱和解读