火狐和IE的JS,IE居然报错?求助了,卡了一天 本帖最后由 a6551139 于 2013-06-18 10:52:26 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 本帖最后由 showbo 于 2013-06-18 10:58:29 编辑 不会再报错火狐IEIE的项目计划任务提供的备选内容却出不来了 能否请教下你 <script src="http://www.coding123.net/js/jquery.js"></script><script> (function ($) { $.fn.bgIframe = $.fn.bgiframe = function (s) { if ($.browser.msie && /6.0/.test(navigator.userAgent)) { s = $.extend({ top: 'auto', // auto == .currentStyle.borderTopWidth left: 'auto', // auto == .currentStyle.borderLeftWidth width: 'auto', //auto == 200px; height: 'auto', // auto == offsetHeight opacity: true, src: 'javascript:false;' }, s || {}); var prop = function (n) { return n && n.constructor == Number ? n + 'px' : n; }, html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' + 'style="display:block;position:absolute;z-index:-1;' + (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') + 'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' + 'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' + 'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth-2010+\'px\')' : prop(s.width)) + ';' + 'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' +'"/>'; return this.each(function () { if ($('> iframe.bgiframe', this).length == 0) this.insertBefore(document.createElement(html), this.firstChild); }); } return this; }; })(jQuery); jQuery.fn.selectCity = function (targetId) { var _seft = this; var targetId = $(targetId); this.click(function () { var A_top = $(this).offset().top + $(this).outerHeight(true); // 1 var A_left = $(this).offset().left; targetId.bgiframe(); targetId.show().css({ "position": "absolute", "top": A_top + "px", "left": A_left + "px" }); }); targetId.find("#22").click(function () { targetId.hide(); }); $(document).click(function (event) {//alert(_seft[0].id) if (event.target.id != _seft.selector.substring(1)) { targetId.hide(); } }); targetId.click(function (e) { e.stopPropagation(); // 2 }); return this; } $(function () { $("#selecttags").selectCity("#m_tagsItem"); }); </script><input type="text" id="selecttags" /><div style="display:none;position:absolute;" id="m_tagsItem"><div>item1</div><div>item1</div><div>item1</div><div>item1</div></div>测试了下没问题。。你的代码应该也没问题,除非其他代码干扰了。 $(document).click(function (event) {alert(_seft)//alert(_seft.selector)// if (event.target.id != _seft.selector.substring(1)) { targetId.hide(); } }); $(document).ready(function () { var searchBox = $("#realReport"); searchBox.focus(function () { if (searchBox.val()==this.title) { alert("1111"); searchBox.val(""); } }); searchBox.blur(function () { if (searchBox.val() == "") { searchBox.val(this.title); } }); searchBox.blur(); }); <textarea id="realReport" name="realReport" style="font-size:12px;text-align:left;resize:none;" title="1.项目目前的总体进展情况; 2.双方项目成员做的比较好的地方或个人表现比较好的地方进行说明; 3.双方项目成员做的不到位的地方; 4.目前项目存在的问题。" cols="46" rows="9"></textarea>我火狐测试没问题 为什么IE点击该文本框 title还是存在呢IE火狐 firefox下textarea里面的回车只算一个\nIE是2个字符\r\n输出searchBox.val().length比较当度就知道了 求助各位大神,怎么禁用IE浏览器ContextMenu的其中一项? 用JS编写一个实现数值累加的函数。 类似于商品局部预览特效的JS问题求助 如何实现一点击主菜单,相对应的div中的值就变化 请问这个函数那里错了,谢谢 如何用Office Web 组件打开一个已经存在的execl文件? 如何实现2级树形菜单(可能要用递归) 如何用javascript定位DIV? 再问:我所说的是不出现另存为的对话框,在代码中自动存到硬盘 请教大家一个问题啊! 今天做一个jquery功能的时候遇到一个问题,好像是for循环出现了问题,我解决不了,大家帮忙看看哦,先谢谢你们! 代码如下: 求一个能做这个功能的图表插件!!!
火狐
IE
IE的项目计划任务提供的备选内容却出不来了 能否请教下你
<script>
(function ($) {
$.fn.bgIframe = $.fn.bgiframe = function (s) {
if ($.browser.msie && /6.0/.test(navigator.userAgent)) {
s = $.extend({
top: 'auto', // auto == .currentStyle.borderTopWidth
left: 'auto', // auto == .currentStyle.borderLeftWidth
width: 'auto', //auto == 200px;
height: 'auto', // auto == offsetHeight
opacity: true,
src: 'javascript:false;'
}, s || {});
var prop = function (n) { return n && n.constructor == Number ? n + 'px' : n; },
html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' +
'style="display:block;position:absolute;z-index:-1;' +
(s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') +
'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' +
'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' +
'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth-2010+\'px\')' : prop(s.width)) + ';' +
'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' +
'"/>';
return this.each(function () {
if ($('> iframe.bgiframe', this).length == 0)
this.insertBefore(document.createElement(html), this.firstChild);
});
}
return this;
};
})(jQuery);
jQuery.fn.selectCity = function (targetId) {
var _seft = this;
var targetId = $(targetId);
this.click(function () {
var A_top = $(this).offset().top + $(this).outerHeight(true); // 1
var A_left = $(this).offset().left;
targetId.bgiframe();
targetId.show().css({ "position": "absolute", "top": A_top + "px", "left": A_left + "px" });
});
targetId.find("#22").click(function () {
targetId.hide();
});
$(document).click(function (event) {//alert(_seft[0].id)
if (event.target.id != _seft.selector.substring(1)) {
targetId.hide();
}
});
targetId.click(function (e) {
e.stopPropagation(); // 2
});
return this;
}
$(function () {
$("#selecttags").selectCity("#m_tagsItem");
});
</script>
<input type="text" id="selecttags" />
<div style="display:none;position:absolute;" id="m_tagsItem"><div>item1</div><div>item1</div><div>item1</div><div>item1</div></div>测试了下没问题。。你的代码应该也没问题,除非其他代码干扰了。 $(document).click(function (event) {
alert(_seft)//
alert(_seft.selector)//
if (event.target.id != _seft.selector.substring(1)) {
targetId.hide();
}
});
$(document).ready(function () {
var searchBox = $("#realReport");
searchBox.focus(function () {
if (searchBox.val()==this.title) {
alert("1111");
searchBox.val("");
}
});
searchBox.blur(function () {
if (searchBox.val() == "") {
searchBox.val(this.title);
}
});
searchBox.blur();
}); <textarea id="realReport" name="realReport" style="font-size:12px;text-align:left;resize:none;"
title="1.项目目前的总体进展情况;
2.双方项目成员做的比较好的地方或个人表现比较好的地方进行说明;
3.双方项目成员做的不到位的地方;
4.目前项目存在的问题。"
cols="46" rows="9"></textarea>我火狐测试没问题 为什么IE点击该文本框 title还是存在呢
IE
火狐