如何解决这个Uncaught SyntaxError:asp.net中的意外标识符 [英] how to solve the this Uncaught SyntaxError: Unexpected identifier in asp.net
本文介绍了如何解决这个Uncaught SyntaxError:asp.net中的意外标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨我想打印div内容我写了一个代码就是
hi i want to print div content i write a code for that is
<script type="text/javascript">
function printdiv(printpage){
var headstr="<html><head><title></title></head><body>";
var footstr="</body>";
var newstr=document.all.item(printpage).innerHTML;
var oldstr=document.body.innerHTML;
document.body.innerHTML=headstr + newstr + footstr;
window.print();
document.body.innerHTML=oldstr;
return false;
}
</script>
当我运行它时显示错误:未捕获的SyntaxError:意外的标识符,和line on var headstr =& lt; html>& lt; head>& lt; title>& lt; / title>& lt; / head>& lt; body>;
请帮帮我...
when i run this it shows error : Uncaught SyntaxError: Unexpected identifier,and line on var headstr="<html><head><title></title></head><body>";
please help me...
推荐答案
嗨>
在页面上创建一个新的div添加id
设置div的innerhtml
然后使用window.print打印该元素或部分
我认为你不能直接打印字符串,除非它被渲染。
Hey
Create a new div on page add id to it
set the innerhtml of the div
Then use window.print to print that element or the section
I think you cannot print the string directly unless it gets rendered.
这篇关于如何解决这个Uncaught SyntaxError:asp.net中的意外标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文