- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 MVC 项目中有一个标准表单,其中有一个 DropDownList。当我更改下拉列表的值时,整个页面会重新加载,因为它会导致回发。
我不希望出现这种行为,并且我正在尝试停止下拉列表以进行回发。
然而,这就是奇怪的地方。我通过以下方式定义我的下拉列表:
@Html.DropDownList("sortOrder", null, new { onchange = "startUpdate(this)" })
忽略 Javascipt,没有什么会期望我进行回发。如果我们包含整个表单,我们可以看到这里也是如此:
@using (var form = Html.BeginForm("Query", "Search", FormMethod.Get, new { id="queryform", name="queryform", onsubmit = "startUpdate(this); return false;"}))
{
<b>Sorter efter</b><br />
@Html.DropDownList("sortOrder", null, new { onchange = "startUpdate(this)" })<br />
</div>
<br />
<input type="submit" class="button_green" value="Søg igen ►" id="SearchButton" name="SearchButton" style="float: left;" onclick="_gaq.push(['_trackEvent', 'Ads_listing', 'search_again_click']); startUpdate(this); return false;" />
<input type="reset" class="button_small" value="Nulstil" id="ClearButton" style="float: right;" />
</text>
}
但是,现在聪明人可能会说:
"try to disable JavaScript, and see what happens"
所以我就这么做了。然后回发没有发生。所以我的问题很可能源自某些 JavaScript。
唯一的问题?我好像找不到。
我已经清除了我能想象到的所有与它有关的 JavaScript,但它仍然给我一个回发。
所以,抱歉,我必须包含所有渲染的标记,希望你们能帮助我解决这个大问题(选择的 html 元素称为 sortOrder
):
(我无法复制整个 HTML,因此我删除了一些部分 - 可以在 http://www.amino.dk/virksomhedsbors/search/query?transactionType=2&text=§orList=&priceFrom=&priceTo= 中看到生产版本)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da-dk">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Virksomheder til salg</title>
<script type="text/javascript">var _sf_startpt = (new Date()).getTime()</script>
<link href="/styles/saxis.min.css?v=1" rel="Stylesheet" type="text/css" />
<link target="_blank" href="http://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet" type="text/css">
<link href="http://www.amino.dk/virksomhedsbors/rss.aspx" rel="alternate" title="Virksomheder købes og sælges" type="application/rss+xml" />
<link href="http://www.amino.dk/virksomhedsbors/rss.aspx?type=buy" rel="alternate" title="Virksomheder købes" type="application/rss+xml" />
<link href="http://www.amino.dk/virksomhedsbors/rss.aspx?type=sell" rel="alternate" title="Virksomheder til salg" type="application/rss+xml" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="http://eas4.emediate.eu/EAS_tag.1.0.js"></script>
<script type="text/javascript" src="/Assets/js/global.js?2.0"></script>
<script type="text/javascript" src="/user/infobox?635467592356980146"></script>
<script type="text/javascript">
$(document).ready(function () {
$.ajaxSetup(
{ cache: false }
);
}
);
</script>
<style type="text/css">
<!--
.cell {
padding-left: 15px;
}
-->
</style>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-10494982-1']);
_gaq.push(['_setDomainName', '.amino.dk']);
_gaq.push(['_setCustomVar', 1, 'Medlemstype', 'Ikke registreret', 1]);
_gaq.push(['_setCustomVar', 2, 'VB-type', 'Ikke registreret', 1]);
document.referrer.match(/https?:\/\/[^/]*google\..*[?&]cd=([^&]*)/gi);
var gaqgr = RegExp.$1;
if (gaqgr) {
_gaq.push(['_setCustomVar', 3, 'GoogleRank', gaqgr, 2]);
}
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="background_body">
<div id="topad" style="clear: both; text-align: center; margin: 0 auto 10px">
<div id="EAS_c13cb956" style="width:930px;height:180px;margin:0 auto;border:0;padding:0;"></div>
<script type="text/javascript">
$(document).ready(function() {
EAS_load_fif("EAS_c13cb956", "/EAS_fif.html", "http://eas4.emediate.eu/eas?cu=1202;cre=mu;js=y;target=_blank;ord=635467592356990147", 930, 180);
});
</script>
</div>
</div>
</div>
<div id="body">
<div id="contentBody">
<div id="sidead" style="position: fixed; width: 300px; height: 600px; margin-left: 963px; top:180px;">
<div id="EAS_5408e9fb" style="width:300px;height:600px;margin:0 auto 0 0;border:0;padding:0;"></div>
<script type="text/javascript">
$(document).ready(function() {
EAS_load_fif("EAS_5408e9fb", "/EAS_fif.html", "http://eas4.emediate.eu/eas?cu=13120;cre=mu;js=y;target=_blank;ord=635467592359750304", 300, 600);
});
</script>
</div>
<div id="UserInformation" style="display: none;"></div>
<div class="column left" style="width: 698px;">
<div class="contentBoxtitle2">
<span style="float: right; margin-right: 5px; margin-top: 5px;" id="SAAdd" class="SearchAgentButton"><a href="javascript:void(0);" onclick=" _gaq.push(['_trackEvent', 'Ads_listing', 'add_searchagent_click']); addSearchAgent(); ">Tilføj som søgeagent</a></span>
<h1 class="contentBoxtitle_home" style="width: 395px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;" id="searchtitle">Virksomheder til salg</h1>
</div>
<div id="searchResults">
<div class="contentBoxSubtitle2">
<h2>
Viser <u>1</u> til <u>30</u> af i alt <u>1383</u>
<div style="float: right;">
<< Forrige
|
1 |
<a href="/search/query?transactiontype=2&pagesize=30&pageno=2&sortorder=0">2</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=3&sortorder=0">3</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=4&sortorder=0">4</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=5&sortorder=0">5</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=6&sortorder=0">6</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=7&sortorder=0">7</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=2&sortorder=0">Næste >></a>
</div>
</h2>
</div>
<div class="contentBox2">
<script type="text/javascript">
var sortLink = "/search/query?transactionType=2&text=&priceFrom=&priceTo=&yearFrom=&yearTo=&saleReasons=&canMove=&regions=&operatingRegions=&allOperatingRegionsRequired=&sectors=&allSectorsRequired=&financingAvailable=&country=&pageSize=30&sortOrder={sortOrder}&";
</script>
<div style="text-align: right; margin-bottom: 3px;">Sorter efter <select id="order" name="order" onchange="top.location.href=sortLink.replace("{sortOrder}", this.value); "><option selected="selected" value="0">Relevans</option>
<option value="1">Oprettelsesdato (nyeste først)</option>
<option value="2">Oprettelsesdato (ældste først)</option>
<option value="3">Redigeringsdato (nyeste først)</option>
<option value="4">Redigeringsdato (ældste først)</option>
<option value="5">Pris (højeste først)</option>
<option value="6">Pris (laveste først)</option>
</select></div>
<div class="silverbox even" style="">
<div class="ribbon silver"></div>
<p class="adtitle">
<a href="/saelges/handel/agenturhandel/btb-og-btc-udklaedning-legetoej-og-kostumer-inkl-varelager-til-salg-19115">BtB og BtC Udklædning, legetøj og kostumer inkl varelager til salg</a>
<img src="/images/icon_unlock20x25.png" alt="Du kan kontakte denne annonce" style="width: 20px; height: 25px; border: none;" />
</p>
<p class="regions">Midtjylland</p>
<div class="price"><span class="pricelabel">Udbudspris:</span> <span class="pricevalue">895.000 DKK</span></div>
<div class="category"><span class="categorylabel">Forretningsområde:</span> <span class="categoryvalue">Agenturhandel</span></div>
<p class="description">Velkendt engros firma der handler med udklædning, kostumer og legetøj. Mange faste kunder spredt over hele landet giver en god stabil omsætning. Salget foregår via hjemmeside og kundebesøg<b>...</b></p>
<p class="seemore">
Se flere virksomheder til salg inden for:<br />
<a href="/saelges/handel/agenturhandel">Agenturhandel</a>
</p>
<p class="date" style="float: right; clear: both; text-align: right;">
Senest redigeret 16-09-2014
</p>
</div>
<br />
<br />
</div>
<div class="contentBoxSubtitle2">
<h2>
Viser <u>1</u> til <u>30</u> af i alt <u>1383</u>
<div style="float: right;">
<< Forrige
|
1 |
<a href="/search/query?transactiontype=2&pagesize=30&pageno=2&sortorder=0">2</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=3&sortorder=0">3</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=4&sortorder=0">4</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=5&sortorder=0">5</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=6&sortorder=0">6</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=7&sortorder=0">7</a>
|
<a href="/search/query?transactiontype=2&pagesize=30&pageno=2&sortorder=0">Næste >></a>
</div>
</h2>
</div>
</div>
<div class="contentBoxFooter2"></div>
</div>
<div class="column">
<div class="box">
<p class="title">Indskrænk/ændre søgning</p>
<div class="boxbody">
<form action="/search/query" id="queryform" method="get" name="queryform" onsubmit=" return false;">
Din rolle er:<br/> <input checked="checked" id="trsBuyer" name="transactionType" onclick="startUpdate(this)" type="radio" value="2" /> <label for="trsBuyer">Køber</label> <input id="trsSeller" name="transactionType" onclick="startUpdate(this)" type="radio" value="1" /> <label for="trsSeller">Sælger</label><br />
<br />
<b>Søgeord:</b><br />
<input id="text" name="text" onkeypress="startUpdate(this)" onkeyup="startUpdate(this)" style="width: 210px;" type="text" value="" /><br />
<br />
<b>Forretningsområder:</b><br />
<a href="javascript:void(0);" onclick=" $(this).hide(500); $('#secadv').show(500); ">Avanceret ►</a><span id="secadv" style="display: none;"><input id="allSectorsRequired" name="allSectorsRequired" onclick=" " style="margin-top: 2px;" type="checkbox" value="true" /><input name="allSectorsRequired" type="hidden" value="false" /> <label for="allSectorsRequired">Alle er påkrævet (OG-søgning)</label></span>
<input type="checkbox" onclick=" " name="sectors" value="12" id="sector12" />
<label for="sector12"> Transportmiddelindustri</label></div>
</div>
</div>
<br />
<a id="showadvprops" href="javascript:void(0);" onclick=" _gaq.push(['_trackEvent', 'Ads_listing', 'search_advanced_criteria']); showAdvancedProps(); ">Vis avancerede kriterier ►</a>
<a id="hideadvprops" href="javascript:void(0);" onclick=" showAdvancedProps(); " style="display: none;">Skjul avancerede kriterier ◄</a><br />
<br />
<div id="advsearch" style="display: none;">
<b>Beliggenhed:</b><br />
<div style="height: 100px; overflow: auto; border: 1px solid #999; padding: 1px 1px 1px 1px; margin-top: 2px;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Nordjylland">
<input type="checkbox" name="regions" onclick=" " value="1" id="region1" />
<label for="region1"> Nordjylland</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Midtjylland">
<input type="checkbox" name="regions" onclick=" " value="2" id="region2" />
<label for="region2"> Midtjylland</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Syd- og Sønderjylland">
<input type="checkbox" name="regions" onclick=" " value="3" id="region3" />
<label for="region3"> Syd- og Sønderjylland</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Fyn">
<input type="checkbox" name="regions" onclick=" " value="4" id="region4" />
<label for="region4"> Fyn</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Sjælland, Øerne og Bornholm">
<input type="checkbox" name="regions" onclick=" " value="5" id="region5" />
<label for="region5"> Sjælland, Øerne og Bornholm</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Storkøbenhavn">
<input type="checkbox" name="regions" onclick=" " value="6" id="region6" />
<label for="region6"> Storkøbenhavn</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Ikke oplyst">
<input type="checkbox" name="regions" onclick=" " value="7" id="region7" />
<label for="region7"> Ikke oplyst</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Hele landet">
<input type="checkbox" name="regions" onclick=" " value="8" id="region8" />
<label for="region8"> Hele landet</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Udlandet">
<input type="checkbox" name="regions" onclick=" " value="9" id="region9" />
<label for="region9"> Udlandet</label></div>
</div>
<br />
<b>Opererer i:</b><br />
<a href="javascript:void(0);" onclick=" $(this).hide(500); $('#regadv').show(500); ">Avanceret ►</a><span id="regadv" style="display: none;"><input id="allOperatingRegionsRequired" name="allOperatingRegionsRequired" onclick=" " style="margin-top: 2px;" type="checkbox" value="true" /><input name="allOperatingRegionsRequired" type="hidden" value="false" /> <label for="allOperatingRegionsRequired">Alle er påkrævet (OG-søgning)</label></span>
<div style="height: 100px; overflow: auto; border: 1px solid #999; padding: 1px 1px 1px 1px; margin-top: 2px;">
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Nordjylland">
<input type="checkbox" name="operatingRegions" onclick=" " value="1" id="operatingregion1" />
<label for="operatingregion1"> Nordjylland</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Midtjylland">
<input type="checkbox" name="operatingRegions" onclick=" " value="2" id="operatingregion2" />
<label for="operatingregion2"> Midtjylland</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Syd- og Sønderjylland">
<input type="checkbox" name="operatingRegions" onclick=" " value="3" id="operatingregion3" />
<label for="operatingregion3"> Syd- og Sønderjylland</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Fyn">
<input type="checkbox" name="operatingRegions" onclick=" " value="4" id="operatingregion4" />
<label for="operatingregion4"> Fyn</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Sjælland, Øerne og Bornholm">
<input type="checkbox" name="operatingRegions" onclick=" " value="5" id="operatingregion5" />
<label for="operatingregion5"> Sjælland, Øerne og Bornholm</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Storkøbenhavn">
<input type="checkbox" name="operatingRegions" onclick=" " value="6" id="operatingregion6" />
<label for="operatingregion6"> Storkøbenhavn</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Ikke oplyst">
<input type="checkbox" name="operatingRegions" onclick=" " value="7" id="operatingregion7" />
<label for="operatingregion7"> Ikke oplyst</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Hele landet">
<input type="checkbox" name="operatingRegions" onclick=" " value="8" id="operatingregion8" />
<label for="operatingregion8"> Hele landet</label></div>
<div style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 18px; line-height: 18px;" title="Udlandet">
<input type="checkbox" name="operatingRegions" onclick=" " value="9" id="operatingregion9" />
<label for="operatingregion9"> Udlandet</label></div>
</div>
<br />
<b>Prisinterval:</b><br />
<input id="priceFrom" name="priceFrom" onkeypress=" " onkeyup=" " style="width: 75px;" type="text" value="" /> til <input id="priceTo" name="priceTo" onkeypress=" " onkeyup=" " style="width: 75px;" type="text" value="" />
<br />
<br />
<b>Etableringsår:</b><br />
<input id="yearFrom" name="yearFrom" onkeypress=" " onkeyup=" " style="width: 75px;" type="text" value="" /> til <input id="yearTo" name="yearTo" onkeypress=" " onkeyup=" " style="width: 75px;" type="text" value="" />
<br />
<br />
<b>Virksomheden skal kunne flyttes:</b><br />
<input checked="checked" id="canMoveNI" name="canMove" onclick=" " type="radio" value="" /> <label for="canMoveNI">Ikke vigtigt</label><br />
<input id="canMoveNo" name="canMove" onclick=" " type="radio" value="0" /> <label for="canMoveNo">Nej</label><br />
<input id="canMoveYes" name="canMove" onclick=" " type="radio" value="1" /> <label for="canMoveYes">Ja</label><br />
<br />
<b>Sælgerfinansiering skal tilbydes:</b><br />
<input checked="checked" id="financingAvailableNI" name="financingAvailable" onclick=" " type="radio" value="" /> <label for="financingAvailableNI">Ikke vigtigt</label><br />
<input id="financingAvailableNo" name="financingAvailable" onclick=" " type="radio" value="0" /> <label for="financingAvailableNo">Nej</label><br />
<input id="financingAvailableYes" name="financingAvailable" onclick=" " type="radio" value="1" /> <label for="financingAvailableYes">Ja</label><br />
<br />
<b>Sorter efter</b><br />
<select id="sortOrder" name="sortOrder" onchange=" "><option selected="selected" value="0">Relevans</option>
<option value="1">Oprettelsesdato (nyeste først)</option>
<option value="2">Oprettelsesdato (ældste først)</option>
<option value="3">Redigeringsdato (nyeste først)</option>
<option value="4">Redigeringsdato (ældste først)</option>
<option value="5">Pris (højeste først)</option>
<option value="6">Pris (laveste først)</option>
</select><br />
</div>
<br />
<input type="submit" class="button_green" value="Søg igen ►" id="SearchButton" name="SearchButton" style="float: left;" onclick=" _gaq.push(['_trackEvent', 'Ads_listing', 'search_again_click']); return false; " />
<input type="reset" class="button_small" value="Nulstil" id="ClearButton" style="float: right;" />
</form> </div>
<div class="boxfooter"></div>
</div>
<br />
<div id="EAS_f01c93ec" style="width:240px;height:auto;margin:0 auto;border:0;padding:0;"></div>
<script type="text/javascript">
$(document).ready(function() {
EAS_load_fif("EAS_f01c93ec", "/EAS_fif.html", "http://eas4.emediate.eu/eas?cu=1193;cre=mu;js=y;target=_blank;ord=635467592356970145", 240, 400);
});
</script>
</div>
<div style="clear: both;"></div>
<br />
<div id="bottomad" style="clear: both; text-align: center; margin: 0 auto 10px">
<div id="EAS_3b18704e" style="width:930px;height:180px;margin:0 auto;border:0;padding:0;"></div>
<script type="text/javascript">
$(document).ready(function() {
EAS_load_fif("EAS_3b18704e", "/EAS_fif.html", "http://eas4.emediate.eu/eas?cu=9947;cre=mu;js=y;target=_blank;ord=635467592359760305", 930, 180);
});
</script>
</div>
<div class="contentHeader"></div>
<div class="CommonContentBox">
<script language="javascript" type="text/javascript" src="http://www.amino.dk/content/amino-partners.js"></script>
</div>
<div class="contentFooter"></div>
</div>
<div style="clear: both;"></div>
</div>
<!-- (C)2000-2009 Gemius SA - gemiusAudience / amino.dk / Virksomhedsbors -->
<script type="text/javascript">
<!-- //--><![CDATA[//><!--
//modified 2013-02-11 rjs as per user specs. updates on gemius
var pp_gemius_identifier = 'bQ0w24csi_1RJcq7a4IMCqdFHWxgAe_a9eJp1cOw7Gf.f7';
(function (d, t) {
var ex; try {
var
gt = d.createElement(t), s = d.getElementsByTagName(t)[0], l = 'http' + ((location.protocol == 'https:') ? 's' : '');
gt.async = 'true'; gt.src = l + '://gadk.hit.gemius.pl/xlgemius.js'; s.parentNode.insertBefore(gt, s);
} catch (ex)
{ }
}(document, 'script'));
//end modified 2013-02-11 rjs as per user specs. updates on gemius
//--><!]]>
</script>
<script type="text/javascript">
var _sf_async_config = { uid: 17411, domain: "amino.dk" };
(function () {
function loadChartbeat() {
window._sf_endpt = (new Date()).getTime();
var e = document.createElement('script');
e.setAttribute('language', 'javascript');
e.setAttribute('type', 'text/javascript');
e.setAttribute('src',
(("https:" == document.location.protocol) ? "https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/" : "http://static.chartbeat.com/") +
"js/chartbeat.js");
document.body.appendChild(e);
}
var oldonload = window.onload;
window.onload = (typeof window.onload != 'function') ?
loadChartbeat : function () { oldonload(); loadChartbeat(); };
})();
</script>
<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Chrome","requestId":"048073e31ed74ed68eeda96481c8bd4e"}
</script>
<script type="text/javascript" src="http://localhost:47739/1a675c31cef44fcca8dc0704a89a9da5/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
</html>
我迷路了。我已经搜索了几个小时了,但找不到导致回发的愚蠢 JS。有任何想法吗?这将是一个巨大的帮助。
编辑:
代码中引用了startUpdate。我尝试删除它,但仍然有回发。这是代码:
function startUpdate(sender) {
if (tmr != null) clearTimeout(tmr);
tmr = setTimeout("updateSearch()", 700);
}
function updateSearch() {
tmr = null;
searchParams.transactiontype = $("input[name=transactionType]:checked").val();
searchParams.text = $("input[name=text]").val();
var sct = "";
$("input[name=sectors]:checked").each(function() { sct += $(this).val() + ","; });
searchParams.sector = sct;
searchParams.allsectorsrequired = $("#allSectorsRequired").attr("checked") == "checked" ? "true" : "";
var rgn = "";
$("input[name=regions]:checked").each(function() { rgn += $(this).val() + ","; });
searchParams.region = rgn;
var orgn = "";
$("input[name=operatingRegions]:checked").each(function() { orgn += $(this).val() + ","; });
searchParams.operatingregion = orgn;
searchParams.alloperatingregionsrequired = $("#allOperatingRegionsRequired").attr("checked") == "checked" ? "true" : "";
searchParams.priceFrom = $("input[name=priceFrom]").val();
searchParams.priceTo = $("input[name=priceTo]").val();
searchParams.yearFrom = $("input[name=yearFrom]").val();
searchParams.yearTo = $("input[name=yearTo]").val();
searchParams.canMove = $("input[name=canMove]:checked").val();
searchParams.financingavailable = $("input[name=financingAvailable]:checked").val();
searchParams.orderby = $("select[name=sortOrder]").val();
for (var key in searchParams) {
if ((!psp || psp[key] != searchParams[key]) && searchParams[key]) {
_gaq.push(['_trackEvent', 'Vbørs Søg autoupdate', key, searchParams[key]]);
}
}
psp = $.extend({}, searchParams);
$("#searchResults").load("@Url.Action("SearchJSON", "Search")", searchParams, searchCallback);
var tttxt = " til salg";
if (searchParams.transactiontype != 2) tttxt = " købes";
if (searchParams.text.length > 0) {
$("#searchtitle").text(searchParams.text + tttxt);
document.title = searchParams.text + tttxt;
}
}
最佳答案
根据我在评论中发布的内容,不知何故(您可能知道代码中发生这种情况)您的 onchange
事件处理程序正在更改,从 startUpdate(this)
至top.location.href=sortLink.replace("{sortOrder}", this.value);
.
所以,当 select
更改时,它会替换页面 URL,这显然会导致刷新(通过 GET)。
关于c# - ASP.NET MVC DropDownList 导致我不期望的回发 - 似乎源自 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25941358/
你能定义自动回发和回发吗?它们的区别,哪些Web服务器控件支持自动回发和回发,以及回发和回调之间的区别? 最佳答案 回发:页面向自身执行 POST 请求 autopostback:自动执行回发,例如当
我有一个 ASP.NET 表单,其中包含一个下拉列表,它会在更改时发回服务器,并用一些日期填充第二个下拉列表。 该表单还包含其他字段,其中一些字段在客户端进行验证,另一些字段在服务器端进行验证。 这是
我需要在我的 ASPX 页面中使用 JavaScript 确认函数来确认基于 C# 代码中条件的各种操作,而不是直接连接到按钮单击事件。例如。如果计算出记录数 > 200,则询问“你想继续吗?”然后根
我正在尝试为一个项目构建一个非常具体的搜索页面,但我在处理由单个页面上动态生成的控件调用的多个回发时遇到了很多麻烦。 页面必须像这样工作: 有一个复选框,“详细搜索”,会在选中/取消选中时引起回发。
在 React 组件中如何防止它回发,以便在按下提交按钮时页面不会重新加载。 组件代码如下: const class MyComponent extends React.Component { .
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: prevent postback of HtmlButton in C# 这是我的 JavaScript 函数:
我们有一个 ASP.NET MVC3 网络应用程序。我们生成 HTML5 页面。 现在,我们希望将拖放内容(图片、word文档...)发送到HTML5页面,然后发送到Web服务器在 C# 中处理(内容
我正在使用 jquery tab 并遵循 js 方法,如何以及如何修改它以在回发之间保持 tab 状态? (这会将选项卡重置为 page_load 后的第一个选项卡) $(document).read
我正在 ASP.NET 4.0 网站中使用 AjaxFileUpload。问题是,当我上传文件时,它的 UploadComplete 会触发,从而导致回发到页面。在由 AjaxFileUpload 引
我在表单上有三个单选按钮 - A、B、C。这些选择中的每一个都会使用特定于该选项的数据填充一个下拉列表。加载表单时,我将选项 A 设置为选中(默认)。 当我选择按钮 B 或 C 时,AsyncPost
我正在尝试使用 JQuery 阻止页面回发。 $(document).ready(function() { $('#').click(function() {
这个问题是一个更大页面的一部分,但我简化了代码以提供一个简单的示例来说明我正在谈论的内容。基本上我有一个带有 AutoPostBack="true"的 ASP 下拉列表,我想做一些 javascrip
我在页面上有一个 AJAX 请求。 有没有办法找到在页面上触发 AJAX 调用的时间。在 jQuery 或 javascript 中查找或发起一个函数,在页面上调用 AJAX 请求。 最佳答案 参见
我有一个按钮可以通过回发提交我的表单,我想进行一些评估,如果一切都不好显示错误消息并停止回发。我已设法让我的代码进入我的 onsubmit 函数,但无法停止回发。 表格: 功能: function
我正在混合使用 asp.net 网络表单和 asp.net-mvc。要使用我包含的网络表单 routes.IgnoreRoute("Reports/{*pathInfo}"); 在 public st
我的网页中有文本框,其中有RequiredFieldValidators。这些控件的最底部是按钮提交和清除每次我单击提交按钮时,它都会触发来自RequiredFieldValidators的验证,这很
我有一个用 jquery 做的键盘控制菜单(当我按下时,它标记第二个选项,依此类推...) 但是当我选择我需要的选项后,我想单击 Enter 来调用按钮的 OnClick 方法,就像用户真的单击了它一
我有一个表单,用于更新数据库中的一组现有信息。其中有一个选择框,当选择选项“B”时,它会显示一个隐藏部分,而在选项“A”上,它将隐藏该部分。这很好用。 但是,当我从数据库加载记录集并且选择框设置为选项
我有一个 asp.net 项目,我们称它们为对象。所有对象都在转发器中创建: '/>
我有一个 ModalPopup,它将包含一个 gridview 和 4 个用于将项目输入到 gridview 本身的字段。 是否可以在保持模式打开的同时回发到服务器并更新 gridview? 当您提交
我是一名优秀的程序员,十分优秀!