javascript
共 3 篇文章
单引号,双引号,javascript,HTML,转义字符
在一个网页中的按钮,写onclick事件的处理代码,不小心写成如下: <input value="Test" type="button" onclick="alert(""OK"");" /> IE提示出错后,再漫不经心地改为: <input value="Test" type="button" onclick="alert(\"OK\");" /> 结果还是出错。 这时,我就想不通了,虽然我知道最直接的解决方法是写成这样: <input value="" type="button" onclick="alert('OK');" /> 但为什么javascript中的转义字符\没有效果了呢?…
2009-06-02 16:27 · javascript
Objects as associative arrays
On this page I explain how JavaScript objects are also associative arrays (hashes). Using these you can associate a key string with a value string, which can be very useful sometimes. Suppose you have a mouseover / click image swap script. You want to keep track of the status of each image, whether…
2009-03-10 13:56 · javascript
通过jquery的selector获取表单的值
例如有这样的一个表单,我想要通过jquery获取它的各个控件的值: <input type= "text" id = "title_key_word" style='width:95%'></input> <select id = "export_type" style='width:100%' > <option value = "%">All</option> <option value = "PDF">PDF</option> <option value = "XLS">XLS</option> <option value = "HTML">HTML</option> </select…
2009-03-10 13:38 · javascript