|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Pressing enter = <br>
I have to post information to my database and retrieve it.... the information consists of a long string, but its not displayed correctly, (it is displayed as a continous string, hence when i input the problem the info is spaced out on different lines / paragraphs........ but is redisplayed as a continous string.
How do i write the code to display a <br> when i press the enter key (for a new Line) in the message posting box |
|
#2
|
|||
|
|||
|
You should use the server-side language you are using to convert \n \r or \n\r with <br> (or <br />, if you are using XHTML).
|
|
#3
|
||||
|
||||
|
__________________
This is my code. Is it not nifty? "The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools." ---Douglas Adams Join the Itsacon fanclub! Zero Tolerance: Spammers banned so far: 264
![]() |
|
#4
|
||||
|
||||
|
also you could use javascript...
var string="use this - for example"; //what ever the string is you are trying to post string.replace("-"," - by - "); document.write(string); OUTPUT... use this - by - for example or you could have a onkeypress event on the textboxes and when the key [enter] is pressed, it will take the current value and delete the current enter mark, and replace it with "<br />", then post it back to the textbox within a function. hope this helped colton22 - http://www.freewebs.com/colton22 |
|
#5
|
|||
|
|||
|
Keep in mind that some Internet users use a browser that doesn't have JavaScript enabled.
Hence, you should not use JavaScript to do this. |
|
#6
|
||||
|
||||
|
Not to mention you should always run addslashes() as well before storing any user-input in a DB.
Otherwise a malicious user could easily run some pretty destructive queries... |
|
#7
|
||||
|
||||
|
yea, i do agree with you all because serverside, javascript is compiled before sent to the user, what is the most common serverside langauge, and easiest to learn, im going to try to learn a serverside
colton22 |
|
#8
|
|||
|
|||
|
colton22, I'm not sure what you mean. Perhaps if you used correct grammar it would be clearer.
If you're looking for a recommendation as to which server-side language to learn, I recommend PHP. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Pressing enter = <br> |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|