I have a script that is working but I can't figure out how to add
paragraph breaks into the textarea. Can anyone help me? If you run the
script, the problem will be easier to understand. If possible too, can
you let me know how to run two instances of the drop down box using the
same array.
<script language="JavaS cript">
var teams=new Array()
teams[0]="Karen L. <br><br> Marlene T. <br><br> Joyce A. <br><br>
Mickey Z.";
teams[1]="Joan T. <br><br> June G. <br><br> Alice G. <br><br> Sandy
B.";
teams[2]="Mary B. <br><br> Amy S. <br><br> Carol C. <br><br> Dee V.";
teams[3]="Bev W. <br><br> Fran D. <br><br> Barb F. <br><br> Gerry B.";
teams[4]="Blind <br><br> Lynda F. <br><br> Gail J. <br><br> Val B.";
teams[5]="Helen N. <br><br> Sandy S. <br><br> Pat D. <br><br> Blind";
teams[6]="Dora F. <br><br> Yo P. <br><br> Minnie C. <br><br> Blind";
teams[7]="<br>You Must Bowl NO <br> LESS THAN ( <INPUT TYPE=text
NAME=PPG SIZE=2 MAXLENGTH=3> ) To <br> Take A Point Per Game!!!";
teams[8]="Please select a team!"
function changecontent(w hich){
document.ddmess age.contentbox. value=teams[which.selectedI ndex]
}
document.ddmess age.contentbox. value=teams[document.ddmess age.selectbox.s electedIndex]
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="100%"><f orm name="ddmessage "><table border="1"
width="100%" cellspacing="0" cellpadding="0" >
<tr>
<td width="100%"><s elect name="selectbox " size="1"
onChange="chang econtent(this)" >
<OPTION>Selec t Team</option>
<OPTION>Alley Cats </option>
<OPTION>Blind </option>
<OPTION>Dreamer s</option>
<OPTION>Lucky Strikes </option>
<OPTION>Morn D. Lites </option>
<OPTION>Pin Pals</option>
<OPTION>Pin Ups</option>
<OPTION>Ups + Downs</option>
</SELECT> <br>
</td>
</tr>
<tr>
<td width="100%"><t extarea rows="8" name="contentbo x"
cols="35" wrap="virtual"> </textarea><br>
</td>
</tr>
</table>
</form> 2 2830
ThunStorm wrote: I have a script that is working but I can't figure out how to add paragraph breaks into the textarea. Can anyone help me? If you run the script, the problem will be easier to understand. If possible too, can you let me know how to run two instances of the drop down box using the same array.
Add another select element just like the first. <script language="JavaS cript">
The language attribute is deprecated, type is required.
<script type="text/javascript"> var teams=new Array()
teams[0]="Karen L. <br><br> Marlene T. <br><br> Joyce A. <br><br> Mickey Z.";
When posting code, manually wrap it at about 70 characters to allow for
a couple of quotes without auto-wrapping introducing errors.
textareas contain plain text, HTML in them will be displayed as plain
text. To get new lines, replace <br> with \n.
teams[1]="Joan T. <br><br> June G. <br><br> Alice G. <br><br> Sandy B."; teams[2]="Mary B. <br><br> Amy S. <br><br> Carol C. <br><br> Dee V."; teams[3]="Bev W. <br><br> Fran D. <br><br> Barb F. <br><br> Gerry B."; teams[4]="Blind <br><br> Lynda F. <br><br> Gail J. <br><br> Val B."; teams[5]="Helen N. <br><br> Sandy S. <br><br> Pat D. <br><br> Blind"; teams[6]="Dora F. <br><br> Yo P. <br><br> Minnie C. <br><br> Blind"; teams[7]="<br>You Must Bowl NO <br> LESS THAN ( <INPUT TYPE=text NAME=PPG SIZE=2 MAXLENGTH=3> ) To <br> Take A Point Per Game!!!";
That isn't going to work even if you fix the wrapping issue.
teams[8]="Please select a team!"
function changecontent(w hich){ document.ddmess age.contentbox. value=teams[which.selectedI ndex]
You could use your 'which' reference to make that a bit shorter:
which.form.cont entbox.value=te ams[which.selectedI ndex];
'which' is a property of the event object in Gecko-based browsers
inherited from old Netscape, you may want to use a different name.
Since it's a reference to a select element, why not 'sel' or similar?
}
document.ddmess age.contentbox. value=teams[document.ddmess age.selectbox.s electedIndex]
You can't get references to document objects that haven't been created
yet, run it from the load event (wrapped for posting):
window.onload = function(){
document.ddmess age.contentbox. value =
teams[document.ddmess age.selectbox.s electedIndex];
}
You should ensure that one option has a selected attribute - user agent
behaviour if no option has a selected attribute is undefined, they may
not all decide to make the same option selected by default.
</script> </head> <body>
<table border="0" cellspacing="0" cellpadding="0" > <tr> <td width="100%"><f orm name="ddmessage "><table border="1" width="100%" cellspacing="0" cellpadding="0" > <tr> <td width="100%"><s elect name="selectbox " size="1" onChange="chang econtent(this)" > <OPTION>Selec t Team</option> <OPTION>Alley Cats </option> <OPTION>Blind </option> <OPTION>Dreamer s</option> <OPTION>Lucky Strikes </option> <OPTION>Morn D. Lites </option> <OPTION>Pin Pals</option> <OPTION>Pin Ups</option> <OPTION>Ups + Downs</option> </SELECT> <br> </td> </tr> <tr> <td width="100%"><t extarea rows="8" name="contentbo x" cols="35" wrap="virtual"> </textarea><br> </td> </tr> </table> </form>
--
Rob
JRS: In article <11************ **********@p10g 2000cwp.googleg roups.com>
, dated Wed, 8 Mar 2006 17:10:53 remote, seen in
news:comp.lang. javascript, ThunStorm <mo******@hotma il.com> posted : I have a script that is working but I can't figure out how to add paragraph breaks into the textarea. Can anyone help me?
F.Code.value = "aa\n\nbb"
And \t may be useful too.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Travis Pupkin |
last post by:
Hi,
I'm putting together a site to allow someone to add content to a DB
through a text area form, and then display it on the web. Pretty basic.
The problem I'm having is that they need to add snippets of javascript,
but by the time its displayed on the page, there have been extra
linebreaks added, breaking the javascript code.
Replace(string, vbCrLf,"") won't work because that removes all
|
by: EmmettPower |
last post by:
Hi,
I am building a small CMS for my son's school. Ideally I want to build
the system for them and hand it over so that all updates can be done
through web-based forms.
So far so good. However I'm having a problem with fields designed to
take multi-paragraph stories or articles. I'm using a text area field
on the form which saves the data in a memo field in the database.
Teachers would typically cut and paste stories from word...
|
by: John Angel |
last post by:
Hi,
I have a pretty wierd situation. I have a javascript function that
runs when I submit a page. The onsubmit code does quite a bit - it
goes through a big textarea and replaces tabs with spaces,
inserts/removes line breaks...it uses regular expressions to convert
textarea content into somethign that can be sent to a mainframe
application.
Here's the problem: Sometimes special characters are pasted into the
|
by: Johnny Two Dogs |
last post by:
I'm strictly concerned with IE, so cross-browser compatibilty isn't
necessary. If you view the code below, I almost get exactly what I'm
looking for:
- A table of four cells that expands/contracts to the width of the
browser window. When it contracts, the cell never gets smaller (in
width) than the largest DIV item.
- When the DIV elements dynamically change, the table cells remain
the same in width (and as a result, the left...
|
by: me |
last post by:
Hello,
I have a node in my xml that is a block of information. This block has
several paragraphs--how can I maintain the paragraph breaks by using <br/>
from the source thru a xsl tranformation process?
i.e:
<information>
GM has been losing sales in the U.S. to Toyota and other Asian rivals and
has faced enormous health care and post-retirement liabilities.
On Thursday, Standard & Poor's Ratings Services cut its corporate credit
| |
by: joelbyrd |
last post by:
Didn't know exactly where to post this, but: How do I get line breaks
in a textarea? I'm pulling text from a database, and this text
definately has line breaks in it, because I
replaced all the line breaks with <br /> tags ( using the php function
nl2br() ), and <br /> tags showed up in the textarea.
|
by: ghostwalker |
last post by:
Hi
I have an HTML form with a textarea on it. When submitted (using 'get'
not 'post') this forms action php file simply does this to retrieve the
values:
$message = $_GET;
Now it all works fine but I get the string in one long string with no
'\n' where the user pressed 'return key'
|
by: Yogi |
last post by:
Hi there,
I have a quick question. In my html document, I want to make a new
paragraph whenever I have a blank line in the html source. Using <p>
and </pevery time is kind of cumbersome (I want to do it the LaTeX
way). Is it possible at all?
Thanks for your time,
Yogi
|
by: EnjoyNews |
last post by:
Hi
I have a little probelm.
I tranfer som data from input fields to a div so you can see how a profil
will look as you type in your data.
I just put this in my input field:
onkeyup="document.getElementById('javao').innerHTML=this.value;"
And this : <span id="javao"></spansomewhere else on the page.
|
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...
|
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...
| |
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,...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |