0

I have a webpage with the following:

<input id="ColourPicker" type="text" value="000000" />
<asp:Label ID="ColourChosen" runat="server" Text="000000" ClientIDMode="Static"></asp:Label>

These are bound to a jPicker:

$(document).ready(
  function () {
    $('#ColourPicker').jPicker(
      {
        images: { clientPath: 'Scripts/images/' },
        window: { position: { x: '25', y: '0' }, expandable: true }
      },
    function(color) {
      var all = color.val('all');
      document.getElementById('ColourChosen').innerHTML = all.hex;
    });
  });

When I select a colour in jPicker and click OK the browser displays:

ColourPicker

The box on the left is ColourPicker and the label on the right is ColourChosen.

When I view the Page Source I see this:

<input id="ColourPicker" type="text" value="000000" />
<span id="ColourChosen">000000</span>

I have some code-behind of this:

protected void Button1Click(object sender, EventArgs e)
{
var l = new List<Borg.PlotColurs> {new Borg.PlotColurs()};
l[0].PlotColour = ColourChosen.Text;
Borg.BulkInsert(ConfigurationManager.ConnectionStrings["utilConnectionString"].ConnectionString, "PlotColours", l);
ListView2.DataBind();
}

I want to see ColourChosen.Text to equal f41313, but it always equals 000000.

What am I doing wrong?

4

1 回答 1

1

您正在查看的页面源是从服务器下载的源。以后通过 Javascript 制作的所有版本(包括插件)都不会反映在页面源中。

要查看您的更改,您应该使用 Firefox 中的 FireBug、Chrome 中的 Chrome devtools 或 Internet Explorer 开发人员工具。

于 2013-04-21T13:19:46.180 回答