Top.Mail.Ru
? ?
Javascript's Journal
 
[Most Recent Entries] [Calendar View] [Friends View]

Friday, August 4th, 2006

Time Event
12:18p
detecting line breaks
I'm sure there has to be a simple answer to this one...

I've got a text area full of text that the user has entered.
I've also got a div that I'm writing information to.

When my JavaScript lifts the text out of the text area and dumps it in the div, it looses its line breaks because (obviously) it's not formatted html.

So here's my question - how do I detect those line breaks and replace them with br tags? My experiments with x.replace-ing \n or \r\n all seem to fail.
2:02p
onChange this.form.submit
I'm having a hell of time trying to figure out what's wrong with this. I simply want a drop down list to auto-submit a form when someone selects something from it. This is what it looks like:

<select name="record_id" onChange="this.form.submit();">
<option value='2'>Blue</option>
<option value='3'>Red</option>
</select>

I've done this dozens of times before.

But when I select an option from it I get the following error:

"Object doesn't support this property or method"

Since WHEN?!

I did a google search to see if anyone else has had this problem and all I get back are tons and tons of examples of people using this exact method without a hitch.

What am I missing?!

Current Mood: Image frustrated

<< Previous Day 2006/08/04
[Calendar]
Next Day >>
About LiveJournal.com
Image