【发布时间】:2014-11-13 03:43:39
【问题描述】:
我认为我对这件事不太正确,对 jquery 很陌生。 我有一个隐藏了 3 个食谱的页面。单击配方 A 的链接时,它会以模式打开。我希望能够只打印食谱的内容。所以我打开一个新窗口(非模态)并尝试将配方写入其中(取决于选择的配方)
这是我正在使用的代码
$('a.new-window').click(function(){
var recipe = window.open('','RecipeWindow','width=600,height=600');
$('#recipe1').clone().appendTo('#myprintrecipe');
var html = "<html><head><title>Print Your Recipe</title></head><body><div id="myprintrecipe"></div></body></html>";
recipe.document.open();
recipe.document.write(html);
recipe.document.close();
return false;
});
但它返回一个错误。我认为它很接近但不太正确。错误是: 失踪 ;声明之前 [打破这个错误] var html = "Print...="myprintrecipe">";\n
【问题讨论】:
标签: javascript jquery