搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

firefox cache loses the "disabled" attribute on html tags

  • 1 个回答
  • 1 人有此问题
  • 22 次查看
  • 最后回复者为 cor-el

more options

If you load a form with a submit button set to "disabled", and then some javascript removes the "disabled" attribute, if you ctrl-r refresh the page the disabled attribute is missing from the refreshed page.

Here is a minimal repro case. Load the page, note the button is grayed out, when asked "remove disabled attribute?" click "ok", then reload the page, and *don't* remove the disabled attribute. The button should be disabled, but isn't.

<html> 
<head>
	<script type="text/javascript">

	function removeDisabledAttribute(){
		if (confirm("remove disabled attribute?")){
			document.testform.searchbutton.disabled = false;
		}
	}
	</script>
</head>

<body onLoad="removeDisabledAttribute();">

	<form name="testform">
		<input type="text">
		<button type="submit" disabled="disabled" name="searchbutton">Search</button>
	</form>

	<br>
	<a href="http://www.google.com">go to google and come back</a>

</body>
</html>
If you load a form with a submit button set to "disabled", and then some javascript removes the "disabled" attribute, if you ctrl-r refresh the page the disabled attribute is missing from the refreshed page. Here is a minimal repro case. Load the page, note the button is grayed out, when asked "remove disabled attribute?" click "ok", then reload the page, and *don't* remove the disabled attribute. The button should be disabled, but isn't. <br /> <pre><nowiki><html> <head> <script type="text/javascript"> function removeDisabledAttribute(){ if (confirm("remove disabled attribute?")){ document.testform.searchbutton.disabled = false; } } </script> </head> <body onLoad="removeDisabledAttribute();"> <form name="testform"> <input type="text"> <button type="submit" disabled="disabled" name="searchbutton">Search</button> </form> <br> <a href="http://www.google.com">go to google and come back</a> </body> </html></nowiki></pre>

由cor-el于修改

所有回复 (1)

more options

A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
The helpers at that forum are more knowledgeable about web development issues.
You need to register at the mozillaZine forum site in order to post at that forum.

See http://forums.mozillazine.org/viewforum.php?f=25