在stringbuilder中的Javascript(Javascript with in stringbuilder)
我根据需要转换了这段代码
http://jquerymsgbox.ibrahimkalyoncu.com/
大家好我已经编写了以下代码来显示警报
public static string ShowAlertMessage(string pHeader, string pError, Page page) { //StringBuilder sb = new StringBuilder(); StringBuilder strScript = new StringBuilder(); strScript.Append("<script type='text/javascript' src='Scripts/jquery-1.4.1.js'>"); strScript.Append("</script>"); strScript.Append("<script type='text/javascript' src='Scripts/jquery.msgBox.js'>"); strScript.Append("</script>"); strScript.Append("<link href='Styles/msgBoxLight.css' rel='stylesheet' type='text/css'>"); strScript.Append("</link>"); strScript.Append("<script type='text/javascript'>"); strScript.Append("function example()"); strScript.Append("{"); strScript.Append("$msgBox({"); strScript.Append("title:" + pHeader + ""); strScript.Append(","); strScript.AppendLine("content:" + pError + ""); strScript.Append("});"); strScript.Append("}"); strScript.Append("</script>"); page.ClientScript.RegisterStartupScript(page.GetType(), "Script", strScript.ToString(), true); return strScript.ToString(); }
但这并没有给我预期的输出可以帮助我在哪里出错
这是生成的字符串构建器
<script type='text/javascript' src='Scripts/jquery-1.4.1.js'></script> <script type='text/javascript' src='Scripts/jquery.msgBox.js'></script> <link href='Styles/msgBoxLight.css' rel='stylesheet' type='text/css'></link> <script type='text/javascript'> function example() { $msgBox({title:Testing Code, content:Hello }); } </script>
This code I converted as per needed
http://jquerymsgbox.ibrahimkalyoncu.com/
Hi all I have written the following code to display an alert
public static string ShowAlertMessage(string pHeader, string pError, Page page) { //StringBuilder sb = new StringBuilder(); StringBuilder strScript = new StringBuilder(); strScript.Append("<script type='text/javascript' src='Scripts/jquery-1.4.1.js'>"); strScript.Append("</script>"); strScript.Append("<script type='text/javascript' src='Scripts/jquery.msgBox.js'>"); strScript.Append("</script>"); strScript.Append("<link href='Styles/msgBoxLight.css' rel='stylesheet' type='text/css'>"); strScript.Append("</link>"); strScript.Append("<script type='text/javascript'>"); strScript.Append("function example()"); strScript.Append("{"); strScript.Append("$msgBox({"); strScript.Append("title:" + pHeader + ""); strScript.Append(","); strScript.AppendLine("content:" + pError + ""); strScript.Append("});"); strScript.Append("}"); strScript.Append("</script>"); page.ClientScript.RegisterStartupScript(page.GetType(), "Script", strScript.ToString(), true); return strScript.ToString(); }
But this is not giving me the expected output can some one help me where I went wrong
This is the generated string builder
<script type='text/javascript' src='Scripts/jquery-1.4.1.js'></script> <script type='text/javascript' src='Scripts/jquery.msgBox.js'></script> <link href='Styles/msgBoxLight.css' rel='stylesheet' type='text/css'></link> <script type='text/javascript'> function example() { $msgBox({title:Testing Code, content:Hello }); } </script>
原文:https://stackoverflow.com/questions/16885123
最满意答案
List是引用列表。 如果从一个列表中获取引用并将其添加到另一个列表,则两个列表都引用同一对象 。
如果您获得对此类对象的引用并对其进行变更(设置字段),则更改将反映在两个列表的相关元素中。
A List is a list of references. If you get a reference from one list and add it to another list, both lists have references to the same object.
If you get a reference to such an object and mutate it (set a field), the change will be reflected in the relevant element of both lists.
相关问答
更多-
你的理解是完全错误的 key的整个目的是为了ordering而不是rendering 。 图像中有项目a,b,c,d,并通过开关a和c重新排序,即c,b,a,d。 没有密钥,就很难做出反应来弄清楚如何从旧的虚拟DOM转换到新的虚拟DOM。 请阅读此https://facebook.github.io/react/docs/lists-and-keys.html Your understanding is completely wrong The whole purpose of key, is for or ...
-
在您的程序中,数据结构的name字段被定义为pointer 。 因此,当你strcpy ,会有内存损坏,因为没有为pointer分配空间。 因此,要么malloc为每个节点的name空间,要么将name定义为n元素的数组。 In your program, the name field of your data structure is defined to be a pointer. Hence, when you strcpy, there will be memory corruption as no ...
-
List是引用列表。 如果从一个列表中获取引用并将其添加到另一个列表,则两个列表都引用同一对象 。 如果您获得对此类对象的引用并对其进行变更(设置字段),则更改将反映在两个列表的相关元素中。 A List is a list of references. If you get a reference from one list and add it to another list, both lists have references to the same object. If you get a ref ...
-
因为你正在使用.append(''); ,每次更改时,都会将新选项添加到现有列表中。 相反,你可以使用: .html(''); // remove old options 要重置select并删除旧选项,请使用: .append(''); // add new o ...
-
对问题2的回答: 转到顶部功能区上的列表 - >列表选项卡 - >工作流设置 - >在SharePoint Designer中创建工作流。 在工作流程中添加名称 - >确定。 将设置更改为仅在更改项目时启动。 添加操作“更新列表项” - >单击“此列表” 选择“列表:当前项目” - >单击“添加” 在“设置此字段:”中选择标题列; 在“To this value:”中点击“...” 在“字符串生成器”对话框窗口中单击“添加或更改查找” 数据来源:当前项目; 来自源的字段:您的标题列 - >确定 它看起来像这 ...
-
使用myList.setHandlesInput(true); 在您的活动代码中。 Use myList.setHandlesInput(true); in your event code.
-
你做的是一个浅拷贝。 浅复制和深复制之间的区别仅与复合对象(包含其他对象的对象,如列表或类实例)相关: 浅拷贝构造一个新的复合对象,然后(尽可能)将引用插入到原始对象中。 深层复制构造一个新的复合对象,然后递归地将复制插入原始对象中的对象。 你想要做什么来创建一个全新的对象,以便不会干扰其他对象。 以下是如何进行深层复制。 import copy a = [[1, 1], [2, 2], [3, 3]] b = copy.deepcopy(a) a[0][0] = 100 print(a) print(b ...
-
要仅打印未更改的文件,请使用: git ls-files -v | grep '^[[:lower:]]' 你可以按日期等排序。希望它有所帮助。 To print just the files that are unchanged use: git ls-files -v | grep '^[[:lower:]]' You can than sort them by date etc. Hope it helps.
-
在w2ui 1.5中,您可以使用$jQueryElement.w2field()来访问w2fild对象 - 然后对其进行操作。 例: var field = $("#my_input").w2field(); field.options.items = ["my", "new", "items"]; // optionally: pre-select first item field.setIndex(0); // if you do NOT use "setIndex" you need to call ...
-
更改了对象中列表中的所有对象值,而不是仅更改了一个(Changed all objects value in list in object changed instead of only one)[2022-02-22]
您正在添加对一个原始obj()实例的引用: self.pos.append(self.pos[men]) 那不是副本; 这只是对同一个对象的另一个引用。 改为创建一个新的 obj()实例: self.pos.append(obj(self.pos[men].x, self.pos[men].y)) You are adding references to your one original obj() instance: self.pos.append(self.pos[men]) That's no ...