问题描述
通过以下HTLM:
< HTML和GT;
<身体GT;
<形式的行动=#>
< P><输入类型=文本>< /输入>< / P>
< /表及GT;
< /身体GT;
< / HTML>
在负载输入有一个空值。
将其更改为1,然后输入(提交)
的页面将显示一个1
pressing后面将pre灌注与输入的1的页,而不是初始状态(空)
我的现实世界的应用程序,其中页面的顶部包含搜索输入和底部的结果一个asp.net页面。当pressing后面的字段是用不与在下面所示的结果中所示的值对应的值pfilled $ P $
我怎样才能让这个浏览器的后退按钮将pre灌注的页面,与历史上的相应页面的初始状态对应的值?
我想preFER不禁止asp.net缓存,但如果没有替代不会介意。
所有谷歌命中禁用缓存,虽然没有工作。
更新结果
我想输入的值应该对应于历史记录列表项的初始状态。
这似乎不是这种情况。它之前后右侧对应的状态。
- 的http:\\本地主机:8080 \\ index.html的=>输入=
- 的http:\\本地主机:8080 \\ index.html的VAL = 2 =>输入=2
- 的http:\\本地主机:8080 \\ index.html的=>输入=2
这应该工作。这是一个jQuery的功能,所以你需要有一个在你的页面引用。作为一个例子,这将设置的输入项为A的价值...
$(文件)。就绪(函数(){
//在页面显示在此之后code将被立即执行。
//ROPT,是该领域的ID。
$(#ROPT)VAL(A)。
});
With the following htlm:
<html>
<body>
<form action="#">
<p><input type="text"></input></p>
</form>
</body>
</html>
On load the input has an empty value.Change it to "1" and enter (submit)The page will show a "1"Pressing back will prefill the page with the entered "1" instead of the initial state (empty)
My real world application is an asp.net page where the top of the page contains search inputs and the bottom the results. When pressing back the fields are prefilled with values that don't correspond with the values shown in the results shown below.
How can I make it so that the browser's back button will prefill the page with the values that correspond with the initial state of the history's corresponding page?
I would prefer to not disable asp.net cache but wouldn't mind if there is no alternative.All the google hits for disabling cache didn't work though.
UPDATE
I would think the value of the inputs should correspond to the initial state of the entry in the history list.This doesn't seem to be the case. It corresponds to the state right before post.
- http:\localhost:8080\index.html => input = ""
- http:\localhost:8080\index.html?val=2 => input = "2"
- http:\localhost:8080\index.html => input = "2"
This should work. It's a jquery function so you would need to have that referenced in your page. As an example, this will set the value of the input item to "A"...
$(document).ready(function() {
// this code will be run immediately after the page has displayed.
// "ROpt" is the id of the field.
$("#ROpt").val("A");
});
这篇关于$ P $从右提交之前pssing回prefills投入与价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!