473,749 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1549
do*****@webtv.n et (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
"objectifie d". 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.javas cript:
ÿ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>').rep lace(/<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
12397
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 calcTotalPub() { var tempFed = +document.Form1.value; var tempState = +document.Form1.value;
1
2179
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 work. It works if the tags are <input type=radio...>. This line is OK:
2
3443
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 object" if i change my custom xml dataisland using <xml id="dataisland"></xml> instead of the <div id="dataisland" ...> it shows a "type mismatch" error. I have no problem accesing to the <di> tags inside the <table
9
39781
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 another "record" the values for all previous controls within the div are wiped out. In the javascript function where I add on to the html in the div if I capture all the data in the previous "records" then after adding the new record I can...
7
2044
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
436
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 anywhere. I have managed to add Labels using the following code: Dim extralabel As Label = New Label extralabel.Text = "Generated Label" Me.Controls.Add(extralabel)
8
35983
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
6128
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 what information I put it always add records to database when I click on submit. What can I do to make sure user will not be able to add records to database until he enters the right information? I am posting my code for you guys to have a look...
6
1974
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 when I transfer the info I get this error. The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. If there was an error, you should be able to see...
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.