[英]Whats wrong with following piece of JavaScript
I am creating iframe in which user can set height (stored in setHeight variable) by entering input but I am struck at following and failed to find solution.我正在创建 iframe,用户可以在其中通过输入输入来设置高度(存储在 setHeight 变量中),但我对以下内容感到震惊并且未能找到解决方案。
document.write("<iframe src=\"" + decodeURIComponent(finalSearch) + "\" width=\"100\%\" height="setHeight">");
Please Help!请帮忙!
You're not concatenating the variable setHeight into your string, and you're not escaping all of your double quotes.您没有将变量 setHeight 连接到字符串中,也没有转义所有双引号。 Try this:
尝试这个:
document.write("<iframe src=\"" + decodeURIComponent(finalSearch) + "\" width=\"100\%\" height=\" + setHeight + \">");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.