[英]HTML / Javascript Dynamic line using HR tag
I have create one flow diagram on user choice. 我已经根据用户选择创建了一个流程图。 On selecting option a line should be drawn.
选择选项时,应画一条线。 Line is properly created but it is resetting the option that user selected.
线已正确创建,但正在重置用户选择的选项。
var htmlLine = "<div style='padding:0px; margin:0px; height:" + thickness + "px; background-color:" + color + "; line-height:1px; position:absolute; left:" + cx + "px; top:" + cy + "px; width:" + length + "px;behavior:url(Scripts/-ms-transform.htc); -moz-transform:rotate(" + angle + "deg); -webkit-transform:rotate(" + angle + "deg); -o-transform:rotate(" + angle + "deg); -ms-transform:rotate(" + angle + "deg); transform:rotate(" + angle + "deg);'><hr></div>";
//
//alert(htmlLine);
document.body.innerHTML += htmlLine;
last line is creating some problem. 最后一行造成了一些问题。 when last line is commented everything is fine.
当最后一行被注释时,一切都很好。
Please help me...!!! 请帮我...!!!
one problem i see in your code is that you use single quotations on style. 我在您的代码中看到的一个问题是您在样式上使用了单引号。 You must have something like this : style=".....".
您必须具有这样的内容:style =“ .....”。 You can escape the double quotations by using the '\\' .
您可以使用'\\'来转义双引号。 Your code will look like this :
var htmlLine = "<div style=\\"padding:0px;...etc
-> the double quotation is escaped by the \\ character 您的代码将如下所示:
var htmlLine = "<div style=\\"padding:0px;...etc
>双引号由\\字符转义
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.