在我的带有母版页的 aspx 页面中使用 jquery 滑块时出现错误,例如
The state information is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.
我的代码是
<div class="demo">
<input type="text" class="sliderValue" />
<p>
</p>
<div id="slider"></div>
</div>
和
<script language="javascript">
$("#slider").slider({
range: "min",
value: 1,
step: 10,
min: 0,
max: 1000,
slide: function (event, ui) {
$("input").val(ui.value);
}
});
$("input.sliderValue").change(function (event) {
var value1 = parseFloat($("input").val());
var highVal = value1 * 2;
$("#slider").slider("option", { "max": highVal, "value": value1 });
});
</script>
有什么建议吗??
编辑:但是这段代码在另一个 aspx 页面中运行良好。我可以知道这背后的原因吗
<div>
<input type="text" class="sliderValue" data-index="0" value="10" runat="server" />
<input type="text" class="sliderValue" data-index="1" value="90" runat="server" />
</div>
<br />
<div id="slider">
</div>
和
<script language="javascript">
$(document).ready(function () {
$("#slider").slider({
min: 0,
max: 100,
step: 1,
range: true,
values: [10, 90],
slide: function (event, ui) {
for (var i = 0; i < ui.values.length; ++i) {
$("input.sliderValue[data-index=" + i + "]").val(ui.values[i]);
}
}
});
$("input.sliderValue").change(function () {
var $this = $(this);
$("#slider").slider("values", $this.data("index"), $this.val());
});
});
</script>