问题描述
Hii,
我通过将该脚本附加到我的字符串构建器中,从我的代码中运行javascript。一切都很好,但由于某种原因,渲染成html后的多重符号无法显示
Hii ,
I am running javascript from my code behind by appending that script into my string builder . everything is fine , but for some reason multiply symbol after rendering into html is not get displayed
str.Append("var percent = Number(100 * value / total).toFixed(1);");
这是我的陈述,...我尝试了很多方法..在sttement之前使用@符号,双斜线,但是在为脚本创建html时没有任何内容正在创建
this is my statement ,... i tried many ways .. using @ symbol before sttement , double slashes , but nothing is rendring while html gets created for the script
推荐答案
StringBuilder sb = new StringBuilder();
sb.Append("function myFunction(value, total) {");
sb.Append(" var percent = Number(100 * value / total).toFixed(1);");
sb.Append(" return percent;");
sb.Append("}");
string s = sb.ToString();
我得到的正是我的期望:
What I get is exactly what I expect:
function myFunction(value, total) { var percent = Number(100 * value / total).toFixed(1); return percent;}
所以你要么不做我做的事情,要么做我不做的事情!
我和你的不同?
So you are either not doing something I am, or doing something I'm not!
How does mine differ from yours?
这篇关于我怎么写“ *“使用String Builder附加Javascript函数语句时的乘符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!