<script>
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie (name, value) {
document.cookie = name + "=" + escape (value)
}function myget()
{
document.body.scrollLeft=GetCookie("currentscroll");
}
function myset(){
SetCookie("currentscroll",document.body.scrollLeft);
}
</script>
<body onunload=myset() onload=myget()>
<form>
<table>
<tr><td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
</tr>
</table>
</form>
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie (name, value) {
document.cookie = name + "=" + escape (value)
}function myget()
{
document.body.scrollLeft=GetCookie("currentscroll");
}
function myset(){
SetCookie("currentscroll",document.body.scrollLeft);
}
</script>
<body onunload=myset() onload=myget()>
<form>
<table>
<tr><td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
<td><input><input type=submit></td>
</tr>
</table>
</form>
解决方案 »
- 关于文字滚动(有左右与上下)同时存在的滚动效果
- 下拉列表的问题!
- JavaScript树目录用拖拽进行选择
- js验证输入的字符数
- 请问getElementsByTagName取得的值的类型
- ajax 调用返回值的问题
- 我要做一个在线考试系统,但是我要怎样实现考试页面进入,计时开始以后当页面window.location.href变化或者关闭窗口的时候自动提交呢
- 急,如何动态改变<IFRAME></IFRAME>框架中src的内容
- 一个很急的小问题请教各位高手(在线等待,马上可给高分)
- Ext4 动态加载JS后的调试问题
- 关于列表框中项目的添加和删除
- 关于javascript读取文件的问题(急)!
还有一个问题,提交返回后能不能让输入的焦点不变呢。
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie (name, value) {
document.cookie = name + "=" + escape (value)
}function myget()
{
document.body.scrollLeft=GetCookie("currentscroll");
if(GetCookie("currentfocus")!=null)
eval("document.all."+GetCookie("currentfocus")+".focus();");
}
function myset(){
SetCookie("currentscroll",document.body.scrollLeft);
}
function mysetfocus(obj){
SetCookie("currentfocus",obj);
}
</script>
<body onunload=myset() onload=myget()>
<form>
<table>
<tr><td><input><input type=submit></td>
<td><input id=mytxt onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt2 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt3 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt4 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt5 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt6 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt7 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt8 onfocus=mysetfocus(this.id)><input type=submit></td>
<td><input id=mytxt9 onfocus=mysetfocus(this.id)><input type=submit></td>
</tr>
</table>
</form>
感激感激