感謝任何人提前在我的問題可以幫助我。Javascript - 輸入字段更改設置值的值
我只是試圖在輸入值發生變化時將表單輸入類型=「文本」的值保存到cookie中。想想我幾乎已經擁有了它,但我無法實現它的工作。
這裏是我迄今爲止
- 這是JavaScript Set_cookie功能。
function Set_Cookie(name, value, expires, path, domain, secure)
{
var today = new Date();
today.setTime(today.getTime());
if (expires)
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" +escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "") +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
((secure) ? ";secure" : "");
}
- 這是假設保存輸入變化的函數。
$(document).ready(function() {
$('#inputText1').change(function() {
Set_Cookie('inputText1', .val($(this)), '', '/', '', '');
});
});
- 輸入字段
input type="text" name="inputText1" id="inputText1"
再次感謝的人誰可以提供幫助。
如果你要在括號支付,你應該檢查出的Lisp':P ' –
我想出了答案。在stackoverflow讓我大聲笑後,將與明天所有人分享。它吹走了競爭。 – Dave
你找到答案了嗎? – Jason