|
查看: 894|回复: 8
|
Javascript 疑问~
[复制链接]
|
|
|
请问
<a href="javascript:history.back(1)">Back</a>
这个code....
javascript:history.back()
这个用途是不是可以存着之前所填入的资料??
那个 1 又代表着什么?? 我也看过 - 1的...
有人可以解释给我听听吗??
除了这个function可以存着之前在form里面填入的资料....
还有什么function是可以用的?? |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 27-8-2008 09:31 AM
|
显示全部楼层
为什么没有人回答我的问题????  |
|
|
|
|
|
|
|
|
|
|
发表于 27-8-2008 10:21 AM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 27-8-2008 10:28 AM
|
显示全部楼层
试看用...
<a href="javascript:history.back()">Back</a>
或者
<a href="javascript:history.go(-1)">Back</a>
1是代表forward的意识... -1是back... |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 28-8-2008 10:34 AM
|
显示全部楼层
原帖由 mElO 于 27-8-2008 10:28 AM 发表 
试看用...
Back
或者
Back
1是代表forward的意识... -1是back...
他只是back的function??
没有记录之前在form里面填的东西??
我试过.. 按web browser的 back是完全没完资料....
用这个... 资料还在... 就不需要从写...
所以想确认一下..... 希望你们可以帮到我... 谢谢... |
|
|
|
|
|
|
|
|
|
|
发表于 28-8-2008 02:47 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 28-8-2008 02:59 PM
|
显示全部楼层
我相信你要的是这个...
<script language="JavaScript">
<!--
// Use this function to retrieve a cookie.
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}
// Use this function to save a cookie.
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" + expires.toGMTString());
}
// Use this function to delete a cookie.
function delCookie(name) {
document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}
// Function to retrieve form element's value.
function getValue(element) {
var value = getCookie(element.name);
if (value != null) element.value = value;
}
// Function to save form element's value.
function setValue(element) {
setCookie(element.name, element.value, exp);
}
var exp = new Date();
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 31));
//-->
</script>
</head>
<center><h1>A Form that Remembers</h1></center>
<p>Type whatever you like in the boxes below, click outside the box, reload the page and try to type the details again. This script uses cookies, so if you have them disabled it will of course not work.</p>
<form><table>
<tr>
<td>Your Name: </td>
<td><input type="text" name="yourname" onfocus="getValue(this)" onblur="setValue(this)"></td>
</tr>
<tr>
<td>Your ID: </td>
<td><input type="text" name="yourid" onfocus="getValue(this)" onblur="setValue(this)"></td>
</tr>
<tr>
<td>Your Password: </td>
<td><input type="text" name="yourpassword" onfocus="getValue(this)" onblur="setValue(this)"></td>
</tr>
</table></form> |
|
|
|
|
|
|
|
|
|
|
发表于 2-9-2008 10:08 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 4-9-2008 11:52 PM
|
显示全部楼层
thanks...
will try it later..
recently very busy until no time to test....
anyway very thanks ya..  |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|