Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET错误:“;在关闭子元素之前无法修改父容器元素";_Asp.net_Jquery - Fatal编程技术网

ASP.NET错误:“;在关闭子元素之前无法修改父容器元素";

ASP.NET错误:“;在关闭子元素之前无法修改父容器元素";,asp.net,jquery,Asp.net,Jquery,我有一个巨大的问题,我试图使这种方法。我有一个网页,需要在其中编写一个方法,返回特定属性的编辑器。颜色的方法实现了“来自eyecon.ro的JQUERY Colorpicker” private静态字符串GetColorBox(字符串名称、整型宽度、字符串值) { 返回“”+ "" + “$”(“#colorPickerHolder”+name+”)。ColorPicker(”+ "{" + onSubmit:函数(hsb、十六进制、rgb、el)+ "{" + “$(el).val(十六进制)

我有一个巨大的问题,我试图使这种方法。我有一个网页,需要在其中编写一个方法,返回特定属性的编辑器。颜色的方法实现了“来自eyecon.ro的JQUERY Colorpicker”

private静态字符串GetColorBox(字符串名称、整型宽度、字符串值)
{
返回“”+
"" +
“$”(“#colorPickerHolder”+name+”)。ColorPicker(”+
"{" +
onSubmit:函数(hsb、十六进制、rgb、el)+
"{" +
“$(el).val(十六进制);”+
“$(el).ColorPickerHide();”+
"}," +
“onBeforeShow:函数()”+
"{" +
“$(this.ColorPickerSetColor)(this.value);”+
"}" +
"})" +
.bind('keyup',function()+
"{" +
“$(this.ColorPickerSetColor)(this.value);”+
"});" +
"";
}
我多次调用此方法,但在第一次调用后,第二次调用抱怨:

网页错误详细信息

用户代理:Mozilla/4.0(兼容;MSIE8.0;WindowsNT5.1; Trident/4.0;GTB6;.NET CLR 2.0.50727;.NET CLR 3.0.04506.30;.NET CLR 3.0.04506.648;.NET CLR 3.5.21022;InfoPath.1;.NET CLR 3.0.4506.2152;.NET CLR 3.5.30729)时间戳:周一,2009年11月9日19:35:33 UTC

消息:HTML分析错误:无法修改父容器 子元素关闭之前的元素(KB927917)行:0字符:0 代码:0 URI:

它呈现的HTML如下所示:

<tr>
    <td width="150px" nowrap="nowrap">
        Text color:
    </td>
    <td>
        <input type="text" maxlength="6" size="6" id="colorPickerHolderTextColor" value="000000" /><script type="text/javascript">$('#colorPickerHolderTextColor').ColorPicker({onSubmit: function(hsb, hex, rgb, el) {$(el).val(hex);$(el).ColorPickerHide();},onBeforeShow: function () {$(this).ColorPickerSetColor(this.value);}}).bind('keyup', function(){$(this).ColorPickerSetColor(this.value);});</script>
    </td>
</tr>

<tr>
    <td width="150px" nowrap="nowrap">
        Text size:
    </td>
    <td>
        <input name="TextSize" width="5px" type="text" value=""></input>
    </td>
</tr>

<tr>
    <td width="150px" nowrap="nowrap">
        Background color:
    </td>
    <td>
        <input type="text" maxlength="6" size="6" id="colorPickerHolderBackColor" value="000000" ><script type="text/javascript">$('#colorPickerHolderBackColor').ColorPicker({onSubmit: function(hsb, hex, rgb, el) {$(el).val(hex);$(el).ColorPickerHide();},onBeforeShow: function () {$(this).ColorPickerSetColor(this.value);}}).bind('keyup', function(){$(this).ColorPickerSetColor(this.value);});</script>
    </td>

文本颜色:
$('#colorPickerHolderTextColor').ColorPicker({onSubmit:function(hsb,hex,rgb,el){$(el.val(hex);$(el.ColorPickerHide();},onBeforeShow:function(){$(this.value);}.bind('keyup',function(){$(this.ColorPickerSetColor(this.value);});
文本大小:
背景色:
$('#colorPickerHolderBackColor').ColorPicker({onSubmit:function(hsb,hex,rgb,el){$(el.val(hex);$(el.ColorPickerHide();},onBeforeShow:function(){$(this.value);}.bind('keyup',function(){$(this.ColorPickerSetColor(this.value);});

我不知道为什么会发生这种情况,有人请给我指出正确的方向吗?

尝试在
脚本
标记之前关闭
输入
标记

编辑:您可能还希望从该调用中删除脚本部分,并创建一个专用部分,用于特定类

private static string GetColorBox(string name, int width, string value)
{
    return "<input class=\"myParticularColorBoxingClass\" type=\"text\" maxlength=\"6\" size=\"6\" id=\"colorPickerHolder" + name + "\" value=\"000000\" >";
}

编辑了上面的内容,关闭了输入标签,尝试了这个,但没有任何运气,仍然是相同的错误,然后我应该调用两个方法?将呼叫拆分为两个独立呼叫的目的是什么?尝试关闭输入标签,仍然没有运气…修改了原始帖子中的代码以反映这个Wuuuuuuu它现在可以工作了,谢谢你的帮助,你刚刚救了我一天/一夜:-)
private static string GetColorBox(string name, int width, string value)
{
    return "<input class=\"myParticularColorBoxingClass\" type=\"text\" maxlength=\"6\" size=\"6\" id=\"colorPickerHolder" + name + "\" value=\"000000\" >";
}
<script type="text/javascript">
    //run this after document has finished loading!
    $(document).ready(
      function() { 
         //activate all inputs with "myParticularColorBoxingClass" class
         $('input .myParticularColorBoxingClass').ColorPicker(
                {
                  onSubmit: function(hsb, hex, rgb, el)
                  {
                    $(el).val(hex);
                    $(el).ColorPickerHide();
                  },
                  onBeforeShow: function () 
                  {
                    $(this).ColorPickerSetColor(this.value);
                  }
                })
                .bind('keyup', function()
                {
                  $(this).ColorPickerSetColor(this.value);
                });
      }
   );
</script>