problem with DIV tag in FireFox

M

mike

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>
 
L

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 = ...
 
M

Michael Winter

[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/>
 
M

Mark Preston

Michael said:
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?
 
M

Michael Winter

Michael said:
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
 
M

Mark Preston

Michael said:
Michael said:
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).
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top