- IE错误提示“缺少标识符、字符串或数字”,检查JS文件中对象字面量是否最后包含逗号。比如
var obj = {id: 1, name: 'test',};
紧接'test'后那个逗号就会导致IE出错。而FireFox正常。
- jQuery操作下拉菜单选定某个项目功能在IE中似乎无效。兼容办法:
document.getElementById( id ).selectedIndex = $('#' + id + " option[value='" + someval + "']").attr('index');
- jQuery判断DOM是否存在:
// 判断DOM元素是否存在
if ($('#id')[0] ) {
do_fun(); // exists
}
if ($('#id').length > 0) {
do_fun();
}
-
错误的框架访问:
$(window.top.document).find('#topFrame p').text();
$(window.parent.document).find('#topFrame').remove();
正确的框架访问:
$(window.parent.frames['left'].document).empty(); //删除左框架“内容”
在顶级窗口中
改变框架本身属性,此时的框架是顶级窗口的一个DOM
对象
$(window.parent.parent.document).find('#fs2').attr('cols', '155,*');
$(window.top.document).find('#left').remove();
以下是跨框架访问操作DOM
元素
.
frames
+ id 的方式最兼容
window.top.document.getElementById('left').id;
window.top.frames[0].document.getElementById('SendFlag').id;
window.top.frames['topFrame'].document.getElementById('SendFlag').id;
window.top.frames['left'].document.getElementById('mli0').name;
$(window.top.frames['left'].document).find('#mli0').attr('id');
$(window.top.frames['topFrame'].document).find('p').text('cqple');
$('p', window.top.frames['topFrame'].document).text('cqple');
-
子窗口操作父窗口
// jquery
$("#父窗口元素ID",window.parent.document)...就行了
//js 版本
window.parent.document.getElementById()
- jQuery 对象
var el = $(selector); // 取到的el变量为jquery对象,el[0]则为 selector对象
var node = el.jquery ? el[0] : el; // el.jquery 返回真(其实是jquery版本号)说明el为jquery对象
- jQuery ajax对提交值编码规则
如果是字符串类型不编码,如果是对象则默认调用encodeURIComponent。所以如果$ajax data参数值是自己拼接的字符串那么就需要手工编码一次
var pdata = '&a=33' + '&b=' + encodeURIComponent('zz=3');
// var pdata = {a: 33, b: 'zz=3', c: 'z3&?aj=3', d: encodeURIComponent('z3&?aj=3')};
$.ajax({
type : "POST",
url : "some.php",
data: pdata
success: function(msg){
// do something
}
});
相关推荐
jQuery提示tips特效代码.zip
Tips 基于jQuery的提示框插件,可自动消失可手动消失
js特效脚本含源码和说明jquery随机头像TIPS本资源系百度网盘分享地址
This means that more and more useful jQuery tips, tricks and solutions are coming available. That’s why i created a small list of 26 cool and useful jQuery tips, tricks and solutions.
比如有禁止右键点击、隐藏搜索文本框文字、在新窗口中打开链接、检测浏览器、预加载图片、页面样式切换、所有列等高、动态控制页面字体大小、...类库、禁用Jquery效果、解决Jquery类库与其他Javascript类库冲突问题...
tips • Taking advantage of the surprising graphics power of regular DOM manipulation (DHTML) • Using the Canvas element for additional graphics power • Creating video games • Using math for ...
首先加载jQuery,并启用Tips插件: $ ( function ( ) { $ ( '.demo1' ) . tips ( { msg : 'This is a demo text.' } ) ; $ ( '.demo2, .demo3' ) . tips ( { skin : 'white' , msg : '' } ) ; } ) ;
6.jQuery带Tips动画提示通用表单验证插件下载(jquery validate),动画效果漂亮 7.jQuery鼠标移到下载地址滑出气泡提示效果的插件 8.又一款jquery实现链接Tip演示下载 9.常用jQuery弹出式链接提示效果Tooltip...
Mobile applications come in two basic flavors: native applications, which are ... As jQuery Mobile advances, we hope to update this ebook to cover new features and provide new tips and techniques.
showTips Jquery插件Tips气泡提示插件
Almost every website today uses some form of JavaScript, whether it be used within a server-side programming technology like ASP.NET or a JavaScript library like jQuery or Mootools, or YUI or ...
移动端基于jquery,zepto的UI组件库,目前实现 JS Components:Toast、Action、Tips、Dialog、Swiper、CityPicker、DatetimePicker、Tab、Range Css Component:oneborder、Loading、button 等
jquery-notify是一款简单实用的jQuery消息提示插件,该消息提示插件的特点是可以在显示提示框的时候发出声音。它简单实用,用户体验非常好
//引入JQuery [removed][removed] <span id=tips> <input type=button id=btn1 value=OK1 onclick=alert('hello btn1');> <input type=button id=btn2 value=OK2 click-type=listener> <...
jQuery插件 jquery.pagination.js分页 jquery.dialog.js实施 jquery.tips.js提示框
本文主要参考了Addy Osmani的PPT《提高jQuery性能的诀窍》(jQuery Proven Performance Tips And Tricks)。他是jQuery开发团队的成员,具有一定的权威性,提出的结论都有测试数据支持,非常有价值。
jQuery可以说是web开发领域应用最为广泛的轻量级javascript库,不仅专业的web开发者使用它,很多刚入门的web开发者或者web爱好者也通过使用jQuery轻松地融入到了javascript的开发。 而如果你还希望在这方面做得更好...
document.write('<script type="text/javascript" >BAIDU_CLB_SLOT_ID = "288992";</script>'); document.write(ojs);} if (code=="top210x90_2"){ document.write('<script type="text/javascript" >BAIDU_CLB_SLOT...
<script language="javascript" src="js/jquery-1.4.min.js"> 网站管理员请求和您通话-<a href="http://www.vihchina.net" target="_blank">VIHCHINA.NET</a></h1><span id="doclose"></span> ...
当光标移动到某些元素上时,会弹出像tips的提示框。 代码如下: <!DOCTYPE html> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <title>...