我创建了一个简单的网页。 它包含一个jQuery选项卡,每个选项卡内部都有一个updatePanel。 这看起来像这样:
前两个字段是jQueryUI datepickers,然后是dropdownlist和autocomplete,它们都工作正确,但是当我点击提交按钮时,css会重新加载。 这发生在IE8中。 点击提交后我的下面是屏幕(我的表格被挤压约20px)
如果我删除所有自定义样式并且只留下jQuery ui css,这也会发生。
看起来updatepanel以某种奇怪的方式刷新css。
没有自定义css的视图下方:
我将标签更改为第二个并返回一切看起来没问题:
如何解决这种奇怪的行为?我可以重写我的自定义css,这没问题,但正如我写的那样,这发生在默认的jquery UI CSS上。
编辑: 这是我的示例html文件:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Zrealizowana wysyłka seryjna i zarejestrowane zwroty
</title>
<link type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.19/themes/dark-hive/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js "> </script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.19/jquery-ui.min.js"> </script>
<script type="text/javascript" src="Skrypty.js"></script>
<script type="text/javascript">
function initDatePickerPL() {
$.datepicker.regional['pl'] = {
closeText: 'Zamknij',
prevText: '<Poprzedni',
nextText: 'Następny>',
currentText: 'Dziś',
monthNames: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
monthNamesShort: ['Sty', 'Lu', 'Mar', 'Kw', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Pa', 'Lis', 'Gru'],
dayNames: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
dayNamesShort: ['Nie', 'Pn', 'Wt', 'Śr', 'Czw', 'Pt', 'So'],
dayNamesMin: ['N', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'],
weekHeader: 'Tydz',
dateFormat: 'yy-mm-dd',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''
};
$.datepicker.setDefaults($.datepicker.regional['pl']);
}
function initDatePickers() {
//daty1
var dates1 = $("#dataOd1, #dataDo1").datepicker({
changeMonth: true,
changeYear: true,
onSelect: function(selectedDate) {
var option = this.id == "dataOd1" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates1.not(this).datepicker("option", option, date);
}
});
//daty2
var dates2 = $("#dataOd2, #dataDo2").datepicker({
changeMonth: true,
changeYear: true,
onSelect: function(selectedDate) {
var option = this.id == "dataOd2" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates2.not(this).datepicker("option", option, date);
}
});
}
$(function() {
initDatePickerPL();
$("#tabs").tabs();
$("#radioset1").buttonset();
$("#radioset2").buttonset();
$("input:button, input:submit").button();
initDatePickers();
});
</script>
</head>
<body class="myBody">
<div style="margin: auto; width: 800px">
<form name="ctl01" method="post" action="Default.aspx" id="ctl01">
<div></div>
</script>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Zrealizowana wysyłka</a></li>
<li><a href="#tabs-2">Zarejestrowane wpłaty</a></li>
</ul>
<div id="tabs-1">
<div id="panel1">
<table class="opcje">
<tr>
<td class="legenda">Data od:</td>
<td class="legenda">Dział:</td>
</tr>
<tr>
<td><input name="dataOd1" type="text" id="dataOd1" /></td>
<td>
<select name="dzial1" id="dzial1">
<option value="All">Wszystkie</option>
<option selected="selected" value="DOK">DOK</option>
<option value="DSD">DSD</option>
<option value="DOT">DOT</option>
<option value="DOP">DOP</option>
<option value="DWE">DWE</option>
</select>
</td>
</tr>
<tr>
<td class="legenda">Data do:</td>
<td class="legenda">Grupa:</td>
</tr>
<tr>
<td><input name="dataDo1" type="text" id="dataDo1" /></td>
<td>
<select name="grupa1" id="grupa1">
<option selected="selected" value="0">Wszystkie</option>
<option value="70">Z1</option>
<option value="58">Z2</option>
<option value="59">Z3</option>
<option value="60">Z4</option>
<option value="48">Z5</option>
</select>
</td>
</tr>
<tr>
<td class="legenda">Wierzyciel:</td>
<td></td>
</tr>
<tr>
<td>
<select name="wierzyciel1" id="wierzyciel1">
<option selected="selected" value="0">Wszyscy</option>
<option value="1">P.R.E.S.C.O.</option>
<option value="2">Fundusz</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td class="legenda">Umowa ramowa:</td>
<td class="legenda">Wyświetlanie:</td>
</tr>
<tr>
<td>
<input name="umowa1" type="text" id="umowa1" /><input type="hidden" name="umowa_id1" id="umowa_id1" />
</td>
<td id="radioset1">
<input id="RadioButton1" type="radio" name="gr1" value="RadioButton1" checked="checked" /><label for="RadioButton1">Ilościowo</label>
<input id="RadioButton2" type="radio" name="gr1" value="RadioButton2" /><label for="RadioButton2">Procentowo</label>
</td>
</tr>
<tr>
<td></td>
<td class="guziki">
<input type="submit" name="odswiez1" value="Odśwież dane" id="odswiez1" />
<input type="submit" name="eksportuj1" value="Eksportuj" id="eksportuj1" />
</td>
</tr>
</table>
</div>
</div>
<div id="tabs-2">
<div id="panel2">
<table class="opcje">
<tr>
<td class="legenda">Data od:</td>
<td class="legenda">Dział:</td>
</tr>
<tr>
<td><input name="dataOd2" type="text" id="dataOd2" /></td>
<td>
<select name="dzial2" id="dzial2">
<option value="All">Wszystkie</option>
<option selected="selected" value="DOK">DOK</option>
<option value="DSD">DSD</option>
<option value="DOT">DOT</option>
<option value="DOP">DOP</option>
<option value="DWE">DWE</option>
</select>
</td>
</tr>
<tr>
<td class="legenda">Data do:</td>
<td class="legenda">Grupa:</td>
</tr>
<tr>
<td><input name="dataDo2" type="text" id="dataDo2" /></td>
<td>
<select name="grupa2" id="grupa2">
<option selected="selected" value="0">Wszystkie</option>
<option value="70">Z1</option>
<option value="58">Z2</option>
<option value="59">Z3</option>
<option value="60">Z4</option>
<option value="48">Z5</option>
</select>
</td>
</tr>
<tr>
<td class="legenda">Wierzyciel:</td>
<td class="legenda">Operator (wpisz minimum 3 znaki):</td>
</tr>
<tr>
<td>
<select name="wierzyciel2" id="wierzyciel2">
<option selected="selected" value="0">Wszyscy</option>
<option value="1">P.R.E.S.C.O.</option>
<option value="2">Fundusz</option>
</select>
</td>
<td><input name="operator" type="text" id="operator" /><input type="hidden" name="operator_id" id="operator_id" /></td>
</tr>
<tr>
<td class="legenda">Umowa ramowa:</td>
<td class="legenda">Wyświetlanie:</td>
</tr>
<tr>
<td>
<input name="umowa2" type="text" id="umowa2" /><input type="hidden" name="umowa_id2" id="umowa_id2" />
</td>
<td id="radioset2">
<input id="RadioButton3" type="radio" name="gr2" value="RadioButton3" checked="checked" /><label for="RadioButton3">Ilościowo</label>
<input id="RadioButton4" type="radio" name="gr2" value="RadioButton4" /><label for="RadioButton4">Procentowo</label>
</td>
</tr>
<tr>
<td></td>
<td class="guziki">
<input type="submit" name="Button1" value="Odśwież dane" id="Button1" />
<input type="submit" name="Button2" value="Eksportuj" id="Button2" />
</td>
</tr>
</table>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
这里有jsfiddle链接:http://jsfiddle.net/353TE/