JavaScript A Beginner's Guide 3rd Edition
锋利的jQuery
精通Dojo
Using The Dojo JavaScript Library To Build Ajax Applications
Professional JavaScript For Web Developers 2nd Edition
JavaScript语言精粹
Css Javascript动态网页设计与制作
Learning jQuery1.3
Pro Javascript Ria Techniques
Pro JavaScript Design Patterns
JavaScript The Good Parts
jQuery基础教程
jQuery in Action
Enterprise AJAX
Dom Scripting Dynamic Web Design Techniques
Learning jQuery
jQuery Reference Guide
The Art and Science of JavaScript
Simply JavaScript
The Essential Guide to DreamweaverCS3 with CSS Ajax and PHP
......
1.大家在实际工作中,会写各式各样的赋值语句。
比如最常用的obj.style.display = "none";
如果这样的赋值语句一多,obj.style一排下来都要看晕了
下面我的base.js中的extend函数可以允许用json格式赋值属性甚至是函数句柄
/**
* 扩展函数
* @param target 需要扩展的对象
* @param params 要往target里放的属性和方法
*/
function extend(target, params) {
if (!target) {
target = {};
}
for (var prop in params) {
target[prop] = params[prop];
}
return target;
}
2. 由于ie不完全遵守w3c标准,他的事件模型和别的浏览器不一样。调用的方法也不一样。
如果遇到要为控件动态增加事件。用onclick = function() {}一类的在dom动态创建的时候不一定有效,而且无法绑定多个句柄。下面介绍一个通用的支持全浏览器的绑定事件函数。
在大部分情况下,useCapture用的是false,所以这里干脆写死。
/**
* 动态创建事件句柄
* @param control 需要扩展的对象
* @param eventName 事件名
* @param fn 函数句柄
*/ ......
JavaScript代码
<mce:script type="text/javascript"><!--
function imageOver(e) {
e.style.border="1px solid red";
}
function imageOut(e) {
e.style.borderWidth=0;
}
// --></mce:script>
<img src="phplamp.gif" onmouseover="imageOver(this)" onmouseout="imageOut(this)" /> JavaScript中style后面的属性应该是什么?
JavaScript CSS Style属性对照表
盒子标签和属性对照
CSS语法 (不区分大小写)JavaScript语法 (区分大小写)
border
border
border-bottom
borderBottom
border-bottom-color
borderBottomColor
border-bottom-style
borderBottomStyle
border-bottom-width
borderBottomWidth
border-color
borderColor
border-left
borderLeft
border-left-color
borderLeftColor
border-left-style
borderLeftStyle
border-left-width
borderLeftWidth
border-right
borderRight
border-right-color
borderRightColor
border-right-style
borderRightStyle
border-right-width
borderRightWidth
border-style
borderStyle
border-top
bo ......
JavaScript代码
<mce:script type="text/javascript"><!--
function imageOver(e) {
e.style.border="1px solid red";
}
function imageOut(e) {
e.style.borderWidth=0;
}
// --></mce:script>
<img src="phplamp.gif" onmouseover="imageOver(this)" onmouseout="imageOut(this)" /> JavaScript中style后面的属性应该是什么?
JavaScript CSS Style属性对照表
盒子标签和属性对照
CSS语法 (不区分大小写)JavaScript语法 (区分大小写)
border
border
border-bottom
borderBottom
border-bottom-color
borderBottomColor
border-bottom-style
borderBottomStyle
border-bottom-width
borderBottomWidth
border-color
borderColor
border-left
borderLeft
border-left-color
borderLeftColor
border-left-style
borderLeftStyle
border-left-width
borderLeftWidth
border-right
borderRight
border-right-color
borderRightColor
border-right-style
borderRightStyle
border-right-width
borderRightWidth
border-style
borderStyle
border-top
bo ......
Technorati 标签: 电脑相关
原文地址:http://www.playes.net/Blog/535.asp
IE 浏览器的脚本失效是个源远流长的问题了,有时撞上了那也只能归结于缘分,完全没得解释。这次本人就是中大彩的缘分,被小小地撞了一下腰。
当然脚本失效也有轻重,有时是页面全部烂晒,图片文字全部显示错位,惨不忍睹,其实坏的这么彻底反倒容易发现问题,也容易解决。最怕就是那种大问题没有小问题不断的情况,像我,基本的脚本效果都支持,就是用到调用 window.opener 的函数方法时报错:类不能支持 Automation 操作。这么具体的出错信息在 Baidu/Google 也找不到什么有用信息,可谓万念俱灰。
严格来说已经很难说是 IE 的错,但按照经验通常你对 IE 进行折腾,例如 IE6 升到 IE7/IE8,或重装,不同程度的第三方软件的修复,一般都不能解决问题。如果一定需要一个理由,应该是在某年某日中了某个木马升级了某个补丁或者卸载某个软件,而导致某个组件某个动态扩展被反注册掉而无法支持某种效果……
说到这里,要说说 regsvr32 命令,是一个注册 DLL 动态扩展库的命令行工具。方法:在“运行”里面输入regsvr32 dllname,回车即可。使用上有几个参数:
/u—&m ......
今天在补习javascript中。遇到几个相对陌生的运算符,特别在此写下来。
1、三元运算符?:,这是js中唯一一个三元运算符(这和C#中的一样),用法如下
var x=1;
var y=3;
(x>y)?(x-y):(y-x);
2、typeof运算符
typeof 是一个一元运算,放在一个运算数之前,运算数可以是任意类型。它返回值是一个字符串,该字符串说明运算数的类型
你知道下面typeof运算的结果吗?
typeof(1);
typeof(NaN);
typeof(Number.MIN_VALUE);
typeof(Infinity);
typeof("123");
typeof(true);
typeof(window);
typeof(document);
typeof(null);
typeof(eval);
typeof(Date);
typeof(sss);
typeof(undefined);
看看你会几个?
如果看了以后,不是很明白的话,请看下面(明白的人就不用往下看了):
typeof是一个一元运算符,它返回的结果始终是一个字符串,对不同的操作数,它返回不同的结果。
具体的规则如下:
一、对于数字类型的操作数而言, ......
没有按别人的推荐,学什么圣经类的js书,而是随便挑了本《JavaScript in 10 Steps or Less》。
花了3个小时,看了30个task。
讲的非常浅显详细。虽然是E文,但很浅显易懂。
task31:
Calling Functions from Tags
One of the benefits of JavaScript is to be able to tie interactivity to elements of the HTML page. One way you can do this is to set up links in HTML that actually trigger calls to JavaScript functions when the link is clicked.
There are two ways to do this:
1. Use the onClick attribute of the a tag to call the function:
<a href=”#” onClick=”functionName()”>Link text</a>
2. Use a javascript: URL in the href attribute of the a tag to call
the function:
<a href=”javascript:functionName()”>Link text</a>
The following task illustrates these two methods of calling a function from a link by creating a function that displays an alert dialog box to the user and then providing two separate links for the user to use to call the fun ......