7750 次
3 回答
4
HTML:
<select id="select">
<option selected>Default</option>
<option value="refresh">Refresh</option>
</select>
JavaScript:
function onchange(e) {
if (e.currentTarget.value === 'refresh') {
window.location.reload();
}
}
document.getElementById('select').addEventListener('change', onchange);
演示:http: //jsfiddle.net/w425208t/
于 2014-09-18T07:16:38.733 回答
1
使用window.location.href = yourUrl;它将“重定向”您到带有 url 的页面yourUrl
于 2014-09-18T07:17:43.377 回答
1
您可以使用以下任何一种:
window.location.reload(false);
// If we needed to pull the document from
// the web-server again (such as where the document contents
// change dynamically) we would pass the argument as 'true'.
//i.e. 'true' will force the page to reload from the server. 'false' will reload from cache, if available.
or
location.reload();
or
window.location.replace(window.location.pathname);
于 2014-09-18T07:22:19.410 回答