<script language="javascript">
$(document).ready(function(){
$("input[name='quantity']").focus(function(){
$(this).css({background:"#ffffff", border:"1px solid #33CC33"}).blur(function(){
var gValue = $(this).val();
var gId = $(this).attr('id');
$.setCookie('av[' + gId + '][quantity]',gValue,{
duration: '',
path : '',
domain : '',
secure : false
}); $(this).css({background:"#ffffff", border:"1px solid #cccccc"});
})
});
});
</script>上面代码是当往INPUT输入内容失去焦点之后保持COOKIE,但是刷新页面INPUT的内容就没了,怎么写让输入的内容一直显示呢? 大虾们请教了? 谢谢!!
$(document).ready(function(){
$("input[name='quantity']").focus(function(){
$(this).css({background:"#ffffff", border:"1px solid #33CC33"}).blur(function(){
var gValue = $(this).val();
var gId = $(this).attr('id');
$.setCookie('av[' + gId + '][quantity]',gValue,{
duration: '',
path : '',
domain : '',
secure : false
}); $(this).css({background:"#ffffff", border:"1px solid #cccccc"});
})
});
});
</script>上面代码是当往INPUT输入内容失去焦点之后保持COOKIE,但是刷新页面INPUT的内容就没了,怎么写让输入的内容一直显示呢? 大虾们请教了? 谢谢!!
$.readCookie('cookie');
$("input[name='quantity']").val($.cookie("your cookie name"));
});