如何通过自动刷新获得提交的修改字段

How to get modified fields submitted with auto refresh

本文关键字:提交 修改 字段 何通过 刷新      更新时间:2023-09-26

我有一个自动刷新的网页。我正试图找到一种方法来改变用户对提交的页面上的字段,这样它们就会被自动刷新并发送到服务器。我知道我可以使用ajax将它们传递回来并将它们保存在服务器端的某个地方,但这似乎有点过头了。我必须在每次更改字段时进行ajax调用。有人知道实现这一点的好方法吗?

自动刷新是通过以下代码实现的:

<noscript>
<meta http-equiv="refresh" content="30">
</noscript>
<script type="text/javascript">
<!--
var sURL = unescape(window.location.pathname);
function doLoad()
{ setTimeout( "refresh()", 30*1000 ); }
function refresh()
{ window.location.href = sURL; }
//-->
</script>
<script type="text/javascript">
<!--
function refresh()
{ window.location.replace( sURL ); }
//-->
</script>
<script type="text/javascript">
<!--
function refresh()
{ window.location.reload( true ); }
//-->
</script>

作为正文的一部分:

<body onload="doLoad()">

edit:
这应该在30秒后提交表单。

// Can't do anything with those that have javascript disabled.
<noscript>
<meta http-equiv="refresh" content="30">
</noscript>
<script type="text/javascript">
var sURL = unescape(window.location.pathname);
function doLoad()
{ setTimeout( "document.myrefreshform.submit()", 30*1000 ); }
</script>