今天我有这个问题,我希望我选择的办法是,在我一页复读时,不实值。 例如,我有:
<select id="options">
<option value="0">Apple</option>
<option value="1">Orange</option>
<option value="2">Mango</option></select>
我的“倡议”的违约是“ Apple”,因此,我想的是,当我点击“奥兰”方案时,那将是我重新上页时的违约价值。 是否有办法这样做? 增 编
今天我有这个问题,我希望我选择的办法是,在我一页复读时,不实值。 例如,我有:
<select id="options">
<option value="0">Apple</option>
<option value="1">Orange</option>
<option value="2">Mango</option></select>
我的“倡议”的违约是“ Apple”,因此,我想的是,当我点击“奥兰”方案时,那将是我重新上页时的违约价值。 是否有办法这样做? 增 编
I think local storage can help to you. So for example:
<select id="options">
<option value="0">Apple</option>
<option value="1">Orange</option>
<option value="2">Mango</option></select>
Javascript
$("#options").on("change", function(){
var val = $(this).val();
// save to local
if(window.localStorage){
window.localStorage.setItem("#options-val", val);
}
});
if(window.localStorage){
var item = window.localStorage.getItem("#options-val");
if(item) $("#options").val(item);
}
参看demo。
你们的所有支部都必须在美元内(文件)。
After后,试图重载网页,你将看到结果!
换成会议时,可以选择。 页: 1
<select id="options" onChange="document.cookie= fruit= +this.value;">
<option value="0">Apple</option>
<option value="1">Orange</option>
<option value="2">Mango</option></select>
<script type="text/javascript">
<!--
function getCookie(cname)
{
/* http://www.w3schools.com/js/js_cookies.asp */
var name = cname + "=";
var ca = document.cookie.split( ; );
for(var i=0; i<ca.length; i++)
{
// var c = ca[i].trim(); // trim not supported on IE8
var c = ca[i].replace(/^s+|s+$/gm, );
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
}
window.onload = function() {
var v = getCookie( fruit );
if (v) document.getElementById( options ).options[v].selected = true;
}
//-->
</script>
选择的“选择”是你想要的缺省。
<option selected="selected">
default
</option>
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!