比如在 abc.html 中引入这两个JS文件:<script type="text/javascript" src="http://localhost/js/jquery-1.4.3.js"></script>
<script type="text/javascript" src="http://localhost/js/jquery.cookie.js"></script>
然后我在 jquery.cookie.js 中写入以下代码(假设叫xx代码):$(document).ready(function() {
$.cookie("abc","123", {
expires:1
} );
alert($.cookie("abc"));
} );
结果是:用 IE 或 Opera 来打开 abc.html 都能使COOKIE生效,唯独用火狐来打开就不能生效要想让火狐也能生效,就必须把xx代码写到 abc.html 页面里这是什么原因呢?
<script type="text/javascript" src="http://localhost/js/jquery.cookie.js"></script>
然后我在 jquery.cookie.js 中写入以下代码(假设叫xx代码):$(document).ready(function() {
$.cookie("abc","123", {
expires:1
} );
alert($.cookie("abc"));
} );
结果是:用 IE 或 Opera 来打开 abc.html 都能使COOKIE生效,唯独用火狐来打开就不能生效要想让火狐也能生效,就必须把xx代码写到 abc.html 页面里这是什么原因呢?
<script type="text/javascript" src="http://localhost/js/jquery-1.4.3.js"></script>
<script type="text/javascript" src="http://localhost/js/jquery.cookie.js"></script>
改为:
<script type="text/javascript" src="jquery-1.4.3.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
试试。
看看出来没
document.execCommand("BackgroundImageCache", false, true);我现在才知道,这句代码与火狐不兼容,谢谢大家