我有一个javascript函数定义在我的基于html/php的页面中间这样 -
<script language="javascript" type="text/javascript">
function popitup2()
{
newwindow2=window.open('','name','height=265,width=350');
var tmp = newwindow2.document;
tmp.write('<html><head><title>Coupon</title>');
tmp.write('<link rel="stylesheet" href="<?php echo get_bloginfo('wpurl'); ?>/wp-content/themes/street/coupon.css">');
tmp.write('<script src="/street/coupon.js"> </script>');
tmp.write('<script src="http://code.jquery.com/jquery-1.4.2.min.js"</script>');
Run Code Online (Sandbox Code Playgroud)
.../*其他一些工作正常的代码*/
现在,当我打开它时,这个网页就会显示出来.但是,如果我从javascript中删除以下2行错误,页面显示正常.
tmp.write('<script src="/street/coupon.js"></script>');
tmp.write('<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>');
Run Code Online (Sandbox Code Playgroud)
有人能说出这些线的编码有什么问题.
我有一个JavaScript代码coupon.js定义如下 -
jQuery(document).ready(function(){
jQuery('.appnitro').submit( function() {
$.ajax({
url : $(this).attr('action'),
type : $(this).attr('method'),
dataType: 'json',
data : $(this).serialize(),
success : function( data ) {
for(var id in data) {
jQuery('#' + id).html( data[id] );
}
}
});
Run Code Online (Sandbox Code Playgroud)
现在Firebug抛出以下错误 -
jQuery is not defined
[Break on this error] jQuery(document).ready(function(){\n
Run Code Online (Sandbox Code Playgroud)
有人可以解释错误和删除它的方法吗?提前致谢.