Refresh problem in Firefox

2019-02-15 23:13发布

In my asp page there is one textbox name "ProductName"

if i write any thing in that textbox and refresh that page , textbox is not clear in firefox. But i open this same page in Internet explore and write any thing in textbox and refresh the page, my textbox comes clear

why textbox not comes clear in FireFox?

This is the html code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<input type="text" id="ProductName" name="ProductName" style="width:235; height:20" value="">
</body>
</html>

8条回答
Melony?
2楼-- · 2019-02-15 23:35

"Actually firefox is stupid that way." - yes it is.

Another way would be to set autocomplete="off" on the input

查看更多
Luminary・发光体
3楼-- · 2019-02-15 23:38

HTMLFormElement instances inherit a reset method.

It can be used to clear all forms to its default values:

for(var i=0; i<document.forms.length; ++i)
    document.forms[i].reset();
查看更多
The star\"
4楼-- · 2019-02-15 23:39

This is a feature of Firefox (one I'm quite fond of). There's nothing you can do about it on the server-side.

EDIT:

The longer version: There is something you can do about, but it's very messy. Basically, the way Firefox implements this is it refills in form elements with the same name when the user hits the refresh button.

The workaround is to change the name attribute on your HTML form elements every time the page loads. How you keep track of what you change them too is left to your discretion, but let me just say that as a Firefox user myself, having a website do this would annoy me no end.

查看更多
男人必须洒脱
5楼-- · 2019-02-15 23:42

for this problem add

autocomplete="off"

attr to input tag for example:

<input type="text" autocomplete="off" id="ProductName" name="ProductName" style="width:235; height:20" value="">
查看更多
别忘想泡老子
6楼-- · 2019-02-15 23:45

You can use Ctrl+Shift+R command to force reload (not from cache) (see Page Navigation Shortcuts on http://www-archive.mozilla.org/docs/end-user/moz_shortcuts.html)

查看更多
劫难
7楼-- · 2019-02-15 23:46

Firefox isn't stupid that way. That's appropriate behavior because presumably the div your fading in occurs on an event e.g. onclick, onchange, etc. And since that event isn't triggered on refresh firefox has no reason to show your div. It's your responsibility to write the js necessary to trigger events onload or when document is ready.

Back to topic: a simple solution is to set the autocomplete attribute of your form to 'off'

That's it.

查看更多
登录 后发表回答