473,748 Members | 4,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check box and append text in textarea

I have create 4 check box, every check on the check box will append text in
textarea and any uncheck on check box will remove text in text area.

Please give some guide on how to control this.

Apr 13 '06 #1
3 6105
juicy said the following on 4/13/2006 4:41 AM:
I have create 4 check box, every check on the check box will append text in
textarea and any uncheck on check box will remove text in text area.

Please give some guide on how to control this.


The easiest way would be to write a script that adds/removes the text
you want or don't want.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 13 '06 #2

juicy wrote:
I have create 4 check box, every check on the check box will append text in
textarea and any uncheck on check box will remove text in text area.

Please give some guide on how to control this.


Why Append/Remove ?

Seems simpler just recreating the whole "text" and setting the textarea
to it.
Warning Untested Sample Code --- Should not be used.

var output = "";
if (document.getEl ementById("chec kbox1id").check ed)
{
output = output + "Text1";
}
if (document.getEl ementById("chec kbox2id").check ed)
{
output = output + "Text2";
}
if (document.getEl ementById("chec kbox3id").check ed)
{
output = output + "Text3";
}
if (document.getEl ementById("chec kbox4id").check ed)
{
output = output + "Text4";
}

The variable "output" whould now be either "Text1Text2Text 3Text4" if
all checkboxes are checked, or "Text2Text4 " if only the 2nd and 4th are
checked ... and so on.

Set the value of the textarea to that and you're set, no need to
append/remove.

Apr 13 '06 #3
Is that possible to include php in the script?
for example:

if (document.getEl ementById("chec kbox1id").check ed)
{
output = output + <? echo $text; ?> ;
}

Thanks.

Apr 24 '06 #4

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

Similar topics

1
3001
by: swaminathang | last post by:
How will I make a text area append only? for eg. if I have some value already initialized for a text area I can add to it but not edit old value. For eg. in a "problem description" text area data can be appended but none of the old details can be tampered with.
2
6047
by: Barti | last post by:
is there any way to check if any textarea or textfield exists in current document fg function checkifexist(){ if any textarea or textfield exist return true else return false } Barti
1
3575
by: Volt | last post by:
is there any way to select and mark part of text in textarea by regular expression? i need to select the first string in textarea whitch is like xxxxx,xxx where x is any character
3
1620
by: frizzle | last post by:
Hi there, I'm building a multi-language PHP/mySQL -site. I'm also building a CMS for the site. There are 5 languages. In the CMS fields for e.g. english bodytext are called (id=) 'bodytext_en'. German looks like 'bodytext_ge', etc. The '_en' part tells us that it's a textfield for english texts.
17
3381
by: HALLES | last post by:
HELLO ! I seek to use a form too fill a file without putting a server on my computer. I am no C# programmer, i can do some things in Javascript but IT CAN T WRITE REWRITE APPEND A FILE ON LOCAL DRIVES . ANY ASP PIECE OF SCRIPT TO HELP AUTOMAT MY INPUTS USIGA FORM LIKE PROCESS ? Regards.
7
3298
by: vunet.us | last post by:
I cannot append a node from XML into the HTML dom (textarea field) in IE. But I can for the text input html elements! Is anyone aware of this and what is the possible solution? Thanks.
0
1619
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi everyone! I have these three questions and though to post them in a single thread: 1) I have created a textarea: <textarea id="txtCards" cols="50" rows="15" runat="server" wrap="virtual" /> which is used for user editing (typing in some info).
19
108004
Frinavale
by: Frinavale | last post by:
Filtering user input is extremely important for web programming. If input is left unfiltered users can input malicious code that can cripple your website. This article will explain how to make sure that the user only submits a number to your .NET web application and also demonstrate how to add JavaScript to your ASPX pages. Upon popular demand, I have added a section that also covers how to use a validator control to check if a text box...
0
9541
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
9370
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
9321
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,...
1
6796
isladogs
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...
0
6074
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();...
0
4602
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...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
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...

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.