Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

firefox javascript problem

Status
Not open for further replies.

IDTstudios1

Programmer
Aug 8, 2004
72
US
the followign script works just fine in IE but doesn't do squat in FF:

<script language="javascript">
<!--
function changeDivHeight() {
var h =document.getElementById('main').style.height;
document.getElementById('sidebar').style.height = h + 200;
}

onload = changeDivHeight;
-->
</script>

I have been pulling my hair out over this. Any help would be great.

Thanks
 
try this:

Code:
function changeDivHeight() {
  var h = parseInt( document.getElementById('main').style.height );
  document.getElementById('sidebar').style.height = ( h + 200 ) + "px";
}

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
cLFlaVA,

works in IE but still no cigar in FF. there are no other Javascript functions on the page either.
 
here are your errors as defined by FireFox's JavaScript Console:

[tt]Error: syntax error
Source File: Line: 1, Column: 4
Source Code:
<script type="text/javascript">[/tt]

[tt]Error: startAjax is not defined
Source File: Line: 29[/tt]

The first will go away when you remove the tags as I've said in my post above. The second is likely caused by the first.

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
ahh

the problem is a more fundamental one involving your interpretation of CSS. For one, height of 100% only functions (properly) if the object's parent element has a staticly set height (600px for example).

additionally, you are not statically setting the height of the 'main' div, and therefore nothing is being returned.

try using the offsetHeight property of the 'main' div instead.

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
and, while i'm still not positive what you're trying to do, may i suggest putting this after you close the 'main' div?

Code:
<div stlye="clear: both;"></div>

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
The CSS error solved the problem?

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
So CSS errors are not female?

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
So what sex are the CSS errors?

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
Good point.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
well actually the error was a bit of CSS and a Firefox bug. Sooo, I guess you could say that CSS and Firefox were having an affair and it caused things to go crazy...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top