代码如下:
<script type="text/javascript">
/**
* 获取指定的键值对对应键的值
*/
function getCookie(c_name) {
if(document.cookie.length > 0) {
var c_Start = document.cookie.indexOf(c_name+"=");
c_start = c_Start + c_name.length + 1;
var c_end = document.cookie.indexOf(";", c_start);
if(c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
//
window.onload=function(){
//alert(123456);
var form = document.getElementById("loginform");
var username = document.getElementById("username");
var password = document.getElementById("password");
if(getCookie("userKey") != null && getCookie("userKey") != "" && getCookie("ssid") != null && getCookie("ssid") != "") {
username.value = getCookie("userKey");
password.value = getCookie("ssid");
//form.submit();//设置自动提交
}
}
</script>
var c_Start = document.cookie.indexOf(c_name+”=”);
c_start = c_Start + c_name.length + 1;
没有了代码提示, c_Start和c_start没有被发现写错,下面的方法将给出明确的提示。
1,打开火狐浏览器
2,打开开发者
3,打开网络
4,选择控制台
5,当你请求网页的时候,会出现一些提示。