468,765 Members | 1,738 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

problem with DIV tag in FireFox

I have a page that uses a some javascript and it works fine in IE but
fails to work in Firefox. Basically what I'm trying to do is have 3
iframes on a page but only displaying one of them at a time. A button
is displayed for the two iframes that are not displayed and when the
button is clicked, the corresponding iframe is shown and the other two
are closed and buttons for the closed iframes are then displayed.

Firefox says basically two things. 1) the div name i'm specifying is
not defined. I tried changing my reference from
emsframe.style='block' to document.emsframe.style='block' and this did
seem to fix that problem but then I get an error saying that the
object has no properties which is referring to the line: <div
id='emsframe' style='display: none'> as well as all the other lines
that define the iframes divisions.

I'm sure it's probably something simple that I'm missing but I don't
see it. any help would be greatly appreciated.

<html>
<head>

<style type="text/css">
input.mysearchterm{font-size: 10pt;font-weight: bold}
input.mybuttons{font-size: 10pt;font-weight: bold}
input.mycancelbuttons{font-size: 10pt;font-weight: bold;color: red}
input.myfindbutton{font-size: 10pt;font-weight: bold}
input.myheaderbutton{font-size: 10pt;font-weight: bold;width:
100%;text-align: right}
select.mysearchtype{font-size: 10pt;font-weight: bold}
</style>

<script language='JavaScript'>
var OpenWindow;

function setMyFocus()
{
document.myform.searchterm.focus();
document.myform.searchterm.select();
}

function openNewAtm()
{
openTmFrame();
mySearchHeader.style.display='none';
myMaintenanceHeader.style.display='block';
document.myform.editmode.value="ADD";
document.myform.target='subframe';
document.myform.action='newatm.asp';
document.myform.submit();
}

function openEmsFrame()
{
tmframe.style.display='none';
tmHeader.style.display='block';
emsframe.style.display='block';
emsHeader.style.display='none';
techframe.style.display='none';
techHeader.style.display='block';
setMyFocus();
}

function openTechFrame()
{
tmframe.style.display='none';
tmHeader.style.display='block';
emsframe.style.display='none';
emsHeader.style.display='block';
techframe.style.display='block';
techHeader.style.display='none';
setMyFocus();
}

function openTmFrame()
{
tmframe.style.display='block';
tmHeader.style.display='none';
emsframe.style.display='none';
emsHeader.style.display='block';
techframe.style.display='none';
techHeader.style.display='block';
setMyFocus();
}

function openEditAtm(theATMID)
{
//mySearchHeader.style.display='none';
//myMaintenanceHeader.style.display='block';
//document.myform.editmode.value='EDIT';
//document.myform.theid.value=theATMID;
//document.myform.target='subframe';
//document.myform.action='editatm.asp';
//document.myform.submit();
}

function openReports()
{
openTmFrame();
mySearchHeader.style.display='none';
myMaintenanceHeader.style.display='block';
document.myform.action='reports.asp';
document.myform.target='subframe';
document.myform.submit();
}

function getResults()
{
if (tmframe.style.display == 'none')
{
openTmFrame();
}

document.myform.action='search.asp';
document.myform.target='subframe';
setMyFocus();
document.myform.submit();

}

function refreshPage()
{
document.myform.action='index.asp';
document.myform.target='';
document.myform.submit();
}

function saveNewAtm()
{
document.myform.target='subframe'
document.myform.submit()
}

</script>
</head>

<body bgcolor='BOC4DE' onLoad='setMyFocus()'>

<form name='myform' method='post' onSubmit='setMyFocus()'
action='search.asp' target='subframe'>
<input name='editmode' type='hidden'>
<input name='theid' type='hidden'>

<div id='myMaintenanceHeader' style='display: none'>
<table border='1' width='750'>
<tr>
<td align='center'><br>
<input type='button' class='mycancelbuttons' value='Cancel and
Return to Search' onClick="refreshPage()">
<br><br></td>
</tr>
</table>
</div>

<div id='mySearchHeader' style='block'>
<table border='1' width='750'>
<tr>
<td>
<table width='100%'>
<tr>
<td align='left'>
<input type='button' value=' Reports ' onClick="openReports()"
class='mybuttons'>
</td>
<td>
<center><font=+2><b>Search By:&nbsp;&nbsp;</b></font>
<select name='searchtype' size='1' class='mysearchtype'
onChange='setMyFocus()'>
<option>ATMID
<option>RC Number
<option>Node Number
<option>Address
<option>Phone Number
</select></center>
</td>
<td align='right'>
<input type='button' value='New ATM' onClick="openNewAtm()"
class='mybuttons'>
</td>
</tr>
<tr>
<td colspan='3' align='center'>
<hr size='2' color='000000'>
<font=+2><b>Enter the Search Term and click
Find:&nbsp;&nbsp;&nbsp;</b></font>
<input type='text' name='searchterm' size='25' maxlength='20'
class='mysearchterm'>
&nbsp;&nbsp;&nbsp;
<input type='button' name='findbutton' value=' FIND '
onClick='getResults()' class='myfindbutton'>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>

<div id='tmHeader' style='display: none'>
<table width='750'>
<tr>
<td align='right'>
<input type='button' name='showTM' value='TESTMASTER '
onClick="openTmFrame()" class='myheaderbutton'>
</td>
</tr>
</table>
</div>

<div id='tmframe' style='display: block'>
<IFRAME src='search.asp' name='subframe' width='750' height='435'
scrolling='auto' frameborder='1'>
</IFRAME>
</div>

<div id='emsHeader' style='display: block'>
<table width='750'>
<tr>
<td align='right'>
<input type='button' name='showEms' value='E M S '
onClick="openEmsFrame()" class='myheaderbutton'>
</td>
</tr>
</table>
</div>

<div id='emsframe' style='display: none'>
<IFRAME src='ems.asp' name='subframe2' width='750' height='435'
scrolling='auto' frameborder='1'>
</IFRAME>
</div>

<div id='techHeader' style='display: block'>
<table width='750'>
<tr>
<td align='right'>
<input type='button' name='showTechs' value='TECHS '
onClick="openTechFrame()" class='myheaderbutton'>
</td>
</tr>
</table>
</div>

<div id='techframe' style='display: none'>
<IFRAME src='techs.asp' name='subframe3' width='750' height='435'
scrolling='auto' frameborder='1'>
</IFRAME>
</div>

</form>
</body>
</html>
Jul 23 '05 #1
6 5901
On 10 Sep 2004 12:41:22 -0700, mike <si*********@hotmail.com> wrote:

[snip]
Firefox says basically two things. 1) the div name i'm specifying is
not defined. I tried changing my reference from emsframe.style='block'
to document.emsframe.style='block' and this did seem to fix that problem
but then I get an error saying that the object has no properties which
is referring to the line: <div id='emsframe' style='display: none'> as
well as all the other lines that define the iframes divisions.


You're being misled by IE. Using an id as a global variable will fail in
the majority of browsers as it's something that Microsoft just dreamt up.
Appending 'document.' doesn't really solve the problem. See the FAQ,
specifically section 4.41.

[snip]

Mike
clj FAQ
<URL:http://jibbering.com/faq/>

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
mike wrote:
I have a page that uses a some javascript and it works
fine in IE but fails to work in Firefox. <snip> I tried changing my reference from
emsframe.style='block' to document.emsframe.style='block' ...

<snip>

<URL: http://jibbering.com/faq/#FAQ4_41 >

Richard.
Jul 23 '05 #3
Lee
mike said:
Firefox says basically two things. 1) the div name i'm specifying is
not defined. I tried changing my reference from
emsframe.style='block' to document.emsframe.style='block' and this did
seem to fix that problem but then I get an error saying that the
object has no properties which is referring to the line: <div
id='emsframe' style='display: none'> as well as all the other lines
that define the iframes divisions.


Javascript errors never refer to lines of HTML code.
They'll be referring to some of the other places where you use
ID attributes as if they were global variables. IE allows that,
but it's the sort of really bad idea that only Microsoft seems
to be able to get away with.

document.getElementById("emsframe").style.display = ...

Jul 23 '05 #4
Michael Winter wrote:

You're being misled by IE. Using an id as a global variable will fail
in the majority of browsers [snip]


You also seem to be confused about what you are using. Most of the time,
you talk about <iframe>, but when it comes to Firefox you call them
<div> layers... which are they?
Jul 23 '05 #5
On Sat, 11 Sep 2004 14:39:40 +0100, Mark Preston
<us****@mpreston.demon.co.uk> wrote:
Michael Winter wrote:
You're being misled by IE. Using an id as a global variable will fail
in the majority of browsers [snip]


You also seem to be confused about what you are using. Most of the time,
you talk about <iframe>, but when it comes to Firefox you call them
<div> layers... which are they?


I didn't write anything about either of those topics. Perhaps you should
reply to the appropriate person and quote what they write, not mistakenly
accuse me of things I didn't do.

And by the way, I meant *prepending* 'document.' shouldn't solve the
problem.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #6
Michael Winter wrote:
On Sat, 11 Sep 2004 14:39:40 +0100, Mark Preston
<us****@mpreston.demon.co.uk> wrote:
Michael Winter wrote:
You're being misled by IE. Using an id as a global variable will
fail in the majority of browsers [snip]

You also seem to be confused about what you are using. Most of the
time, you talk about <iframe>, but when it comes to Firefox you call
them <div> layers... which are they?

I didn't write anything about either of those topics. Perhaps you
should reply to the appropriate person and quote what they write, not
mistakenly accuse me of things I didn't do.

And by the way, I meant *prepending* 'document.' shouldn't solve the
problem.

Mike, my message was to the OP - apologies for sending it as a reply to
your message (it should have included the OP quotes).
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by tagdance | last post: by
3 posts views Thread by cwdjrxyz | last post: by
13 posts views Thread by Giggle Girl | last post: by
8 posts views Thread by Atemporal | last post: by
15 posts views Thread by Mike Driscoll | last post: by
6 posts views Thread by Dennis | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.