Iframe not works in firefox

S

Sunilc

Hi,
following code is works fine in ie but not in firefox. Please help me.

<html>
<head>
<script>
function resizeFrames()
{
var ifrmobjs = document.getElementsByTagName("iframe");
alert(ifrmobjs.length);
for (var i=0;i < ifrmobjs.length;i++)
{
ifrmobjs.style.height = "100px";
}
}
</script>
</head>
<body onload="resizeFrames();">
<iframe id="isystemmanager" name="isystemmanager"
src="Page1.jsp" style="width:100%;display:none" frameborder="0" />

<iframe id="iunitview" name="iunitview"
src="unitView.jsp" style="width:100%;" frameborder="0" />

<iframe id="iunitlist" name="iunitlist"
style="width:100%;display:none;" frameborder="0" />
<iframe id="idataView" name="idataView"
style="width:100%;display:none;" frameborder="0" scrolling="no" />

</body>
</html>

In ie alert shows 4 but in firefox alert shows 1.
 
M

Martin Honnen

Sunilc said:
<body onload="resizeFrames();">
<iframe id="isystemmanager" name="isystemmanager"
src="Page1.jsp" style="width:100%;display:none" frameborder="0" />

<iframe id="iunitview" name="iunitview"
src="unitView.jsp" style="width:100%;" frameborder="0" />

<iframe id="iunitlist" name="iunitlist"
style="width:100%;display:none;" frameborder="0" />
<iframe id="idataView" name="idataView"
style="width:100%;display:none;" frameborder="0" scrolling="no" />

</body>
</html>

In ie alert shows 4 but in firefox alert shows 1.

Use
<iframe ...></iframe>
not
<iframe ... />
unless you serve your markup to an XML parser.
 
T

Thomas 'PointedEars' Lahn

Martin said:
Use
<iframe ...></iframe>
not
<iframe ... />

Better:

<iframe ...>
Alternative content, e.g. a link to the iframe document.
unless you serve your markup to an XML parser.

However, it is not recommended to use empty-element tags for elements
which do not have an EMPTY content model:

,-<http://www.w3.org/TR/xml11/#sec-starttags>
|
| [...]
| Tags for Empty Elements
|
| [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [WFC: Unique Att Spec]
|
| Empty-element tags may be used for any element which has no content,
| whether or not it is declared using the keyword EMPTY. For
| interoperability, the empty-element tag SHOULD be used, and SHOULD
| only be used, for elements which are declared EMPTY.

See also <http://www.w3.org/TR/xhtml-media-types/#compatGuidelines>:

| A.3. Elements that have no content
|
| If an element permits content (e.g., the div element) but an instance
| of that element has no content (e.g., an empty section), DO NOT use
| the "minimized" tag syntax (e.g., <div />).
|
| Rationale: HTML user agents may give uncertain results when using the
| [...] minimized syntax permitted by XML when an element has no content.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top