Closed Bug 309165 Opened 16 years ago Closed 16 years ago

onLoad=something.submit() never loads when inside DIV (display:none) tag

Categories

(Firefox :: General, defect)

All
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 100533

People

(Reporter: srozov, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

onLoad=something.submit() does not run when inside <div style="display:none;">
Even when the information is made visible through javascript.


Reproducible: Always

Steps to Reproduce:
1. Make a new html file using the code below.
2. Make sure to put two images in the same folder as the html file, name 
them 'a.jpg' and 'b.jpg'.
3. When you open the html file in Firefox and you click on 'Show Image b.jpg' 
the image a.jpg should hide and the image b.jpg should be made visible. But 
the image b.jpg is never loaded by the Firefox browser.
4. To see how it should work use Internet Explorer.
Actual Results:  
The image b.jpg is never loaded by the browser and so you get a blank area 
where it should be.

Expected Results:  
Use Internet Explorer to see what should happen.
Basically the image b.jpg should be seen when you click on 'Show Image b.jpg'

-----------------------------------------------------------------------------

<html>
<head>
    <title>Firefox Test</title>
</head>

<script language="Javascript" type="text/javascript">
getElementById = function(id, dontChkForDups)
{
	var oEle = document.getElementById(id);
	return oEle;
}

hide = function(o)
{
o=getElementById(o);
o.style.display="none";
o.style.visibility="hidden";
}

show = function(o)
{
o=getElementById(o);
o.style.display="";
o.style.visibility="visible";
}
</script>
<body>

	<a href="#" onClick="hide('ImageA');show('ImageB');">Show Image 
b.jpg</a></td>
	<br>
	<a href="#" onClick="show('ImageA');hide('ImageB');">Show Image 
a.jpg</a></td>

    <div id="ImageA">
		<iframe id="imgA" src="javascript: false" frameborder="0" 
marginheight="0" width="330" height="280" marginwidth="0" 
scrolling="no"></iframe>
		<script language="Javascript" type="text/javascript">
			var fr = document.getElementById("imgA");
			doc = fr.contentWindow.document;
			doc.write('\n' + '\
				<html>\n' + '\
				<body onLoad=\"document.getElementById
(\'formA\').submit();\">\n' + '\
				<form id=\"formA\" action=\"a.jpg\" 
method=\"post\">\n' + '\
				</form>\n' + '\
				</body>\n' + '\
				</html>\n' + '\
			');
			doc.close();
		</script>
	</div>

    <div id="ImageB" style="display:none;">
		<iframe id="imgB" src="javascript: false" frameborder="0" 
marginheight="0" width="330" height="280" marginwidth="0" 
scrolling="no"></iframe>
		<script language="Javascript" type="text/javascript">
			var fr = document.getElementById("imgB");
			doc = fr.contentWindow.document;
			doc.write('\n' + '\
				<html>\n' + '\
				<body onLoad=\"document.getElementById
(\'formB\').submit();\">\n' + '\
				<form id=\"formB\" action=\"b.jpg\" 
method=\"post\">\n' + '\
				</form>\n' + '\
				</body>\n' + '\
				</html>\n' + '\
	    	');
			doc.close();
		</script>
	</div>
	<br>
	First make sure that you have two images in the same folder as this 
html file. The two images
	should be named 'a.jpg' and 'b.jpg'.
	<p>
	Then clicking on Show Image b.jpg should hide image a.jpg and show 
b.jpg, but this does not work in
	Firefox. It appears that Firefox never even tries to load the image 
b.jpg
	<p>
	(In Firefox when you don't see the image, you can right click where 
the image should be and select
	This Frame -> Reload Frame  and the image will load.)
</body>
</html>
Attached file Test Html File
Related to/duplicate of Core bug 100533?

*** This bug has been marked as a duplicate of 100533 ***
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.