Forum Moderators: open

Message Too Old, No Replies

Works in IE and not in FF.......

Can anyone shed some lights on this one?

         

Civichunter

12:48 am on Aug 26, 2005 (gmt 0)

10+ Year Member



<script language="javascript">

//Function to resize corresponding textarea
function resize(Measurementx, Outcomesx){
//Assign variables to store height of each text area in pixels
MeasurementHeight = (document.getElementById(Measurementx).scrollHeight)
OutcomeHeight = (document.getElementById(Outcomesx).scrollHeight)
MeasurementString = (document.getElementById(Measurementx).value)
OutcomesString = (document.getElementById(Outcomesx).value)

//Assign variables to hold Lenght of string in textarea
MeasurementStringLength = MeasurementString.length
OutcomesStringLength = OutcomesString.length

//If Outcome area is smaller than Measurement area and outcome string is less than Measurement string
//make Measuremnet area
if (OutcomeHeight < MeasurementHeight && OutcomesStringLength < MeasurementStringLength) {
document.getElementById(Outcomesx).style.height = MeasurementHeight
document.getElementById(Measurementx).style.height = MeasurementHeight
document.getElementById(Outcomesx).style.height = MeasurementHeight

//If Outcome area is smaller than Measurement area and outcome string is greater than Measurement string
//make Measurement area same height as Outcome area
} else if (OutcomeHeight < MeasurementHeight && MeasurementStringLength < OutcomesStringLength) {
OutcomeHeight = (document.getElementById(Measurementx).scrollHeight)
document.getElementById(Outcomesx).style.height = OutcomeHeight
document.getElementById(Measurementx).style.height = OutcomeHeight

//If Measurement area is smaller than Outcome area and Measurement String is less than Outcome string
//make Measurement area same height as Outcome area
} else if (MeasurementHeight < OutcomeHeight && MeasurementStringLength < OutcomesStringLength) {
OutcomeHeight = (document.getElementById(Outcomesx).scrollHeight)
document.getElementById(Outcomesx).style.height = OutcomeHeight
document.getElementById(Measurementx).style.height = OutcomeHeight

//If Measurement area is smaller than Outcome area and Measurement String is greater than Outcome string
//make Outcome area same height as Measurement area
} else if (MeasurementHeight < OutcomeHeight && MeasurementStringLength > OutcomesStringLength) {
document.getElementById(Outcomesx).style.height = MeasurementHeight

} else
document.getElementById(Measurementx).style.height = OutcomeHeight
}

</script>

The above code basically resizes the two adjacent textarea on the fly according to which box has more text in it. It works fine in IE but dies in FF.....
Can anyone shed some lights on this one perhaps?

Scally_Ally

9:00 am on Aug 26, 2005 (gmt 0)

10+ Year Member



from my experience with firefox it always seems to be very strict on the actual code that you write, some things that i have written and tested in IE work well but then you test it in FF and it doesnt look the same or whatever..(dont know why), but i end up trawlling through my code.

The one thing that strikes me about yours is that it has no line breaks (;) at the end of each line.
I know this may be stating the obvious but give it a go.

dcrombie

10:39 am on Aug 26, 2005 (gmt 0)



[mozilla.org...]

scrollHeight is part of the MSIE's DHTML object model.
scrollHeight is not part of any W3C specification or technical recommendation