Forum Moderators: open
//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?
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.
scrollHeight is part of the MSIE's DHTML object model.
scrollHeight is not part of any W3C specification or technical recommendation