473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Adding Break Tags to Input Form

**I'd like to know how to add break tags "<br>" inbetween entry's in
an input form, an example is if the word "yada yada" was entered you
would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a

I would like to able to add the break tags with a button onClick. I have
no idea where to start, sorry. Any help is appreciated, Thanks Joe

Jan 7 '06 #1
3 1535
do*****@webtv.net (Papajo) wrote in news:5644-43BF2BEE-207@storefull-
3332.bay.webtv.net:
**I'd like to know how to add break tags "<br>" inbetween entry's in
an input form, an example is if the word "yada yada" was entered you
would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a
You are likely interested in learning about how to manipulate documents
with DOM methods.
I would like to able to add the break tags with a button onClick. I have
no idea where to start


Start with the following:

http://www.w3.org/DOM/
http://developer.mozilla.org/en/docs...y:DOM:Articles

The short lesson is that a document's structure and style can be
"objectified". Paragraph(s), sentences, words, characters---printable and
otherwise---can be treated as objects and properties gotten or set and
methods used to alter the objects. The document is structured as a TREE
with branch points (NODES). The document is rendered as a tree in this way
by the document reader/parser when initially loaded/read, but through these
DOM methods in script, these nodes can be INSERTED/APPENDED or REMOVED to
modify the document structure dynamically. A very simplified explanation.
Jan 7 '06 #2
Papajo wrote on 07 jan 2006 in comp.lang.javascript:
ÿI'd like to know how to add break tags "<br>" inbetween entry's in
an input form, an example is if the word "yada yada" was entered you
would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a


t1 = 'yada yada'

t2 = t1.replace(/( ?[^ ])/g,'$1<br>').replace(/<br>$/,'')

alert(t2)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 7 '06 #3
Thank you guy's, with the code snippet and lessons I was able to get
the script running. Joe

Jan 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: crjunk | last post by:
I have 4 TextBoxes on my form that I'm trying to add together to get a grand total. Here is the code I'm using: <SCRIPT LANGUAGE="JavaScript"> <!-- Beginning of JavaScript - function...
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
2
by: alex bazan | last post by:
I'm building a cross-browser XML dataisland. This code works perfectly in mozilla, but i have problems with explorer. it tells me that: "diXML.getElementsByTagName(..).0 is null or not an...
9
by: Michelle | last post by:
I have a div that is initially empty. Clicking on a button will add some text boxes and other controls so the user can add additional records. In IE all works fine but in Netscape 7.0 when I add...
7
by: | last post by:
What is the beat way to dynamically write/add to the HEAD tag of an ASPX page (the <head runat=server ... is too error prone and not very repeatable)? Thanks.
6
by: Nathan Sokalski | last post by:
I am trying to dynamically add controls to my page, but am having trouble with controls such as buttons. I have been able to add simple controls such as Label controls, because they can be placed...
8
by: David | last post by:
I'm trying to add a date and time to an html form, but I'm having a bit of trouble getting it working. Any suggestions? Thanks! ~ David (merlin001_at_gmail_dot_com)
9
by: Dhiru1009 | last post by:
Hi guys, I am trying to build a user registration form using PHP and MYSQL but encountring a problem. When I click on submit with empty fields it adds records to database also it doesn't matter...
6
nomad
by: nomad | last post by:
Hello Everyone: I'm having troubles with some coding and Idon't know where it is. I have delevopled a calender where the client can add events to a day. The code worked perfect on my computer but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.