JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 27th, 2004, 10:44 PM
nitro2 nitro2 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 nitro2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Adding data depending on checkbox checked or not

Hi there - i have been using the following to add two fields together into one textbox:
PHP Code:
<html>
 
 <
head>
 </
head>
 
 <
body>
 
 <
script language="JavaScript">
 <!--
 function 
upd(){
 
document.a.description.value "Name" "\n" document.a.part1.value "\n" "\n" "Address" "\n" document.a.part2.value;
 }
 
//-->
 
</script>
 
 
 <form name="a">
 <input type="text" name="part1" onKeyUp=upd() size="20"><br>
 <input type="text" name="part2" onKeyUp=upd() size="20"><br>
 <textarea rows="5" name="description" cols="23"></textarea>
 </form>
 
 </body>
 
 </html> 


I was wondering, is it possible to implement checkboxes aswell so that if i checked a checkbox called checkbox1 for example, with the value "running" then the value "running" would be added to the textbox where everything gets added to - if the checkbox was unchecked then "running" would be removed again?!

Is this possible? If so, how do i go about doing this?

Thanks

Reply With Quote
  #2  
Old July 1st, 2006, 12:49 AM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 473 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 19 m 14 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
the best way is to have a sepreate function to add on the running or to not add running

for example

_inverseit=false;
//_inverseit=true;
function yesorno() {
if (_inverseit) {return "not ";}
else {return "";}
}

var string="your favorite food is "+yesorno()+"steak";

if _inverseit is set to be true, it will the string will look like this...

your favorite food is not steak

otherwize like this

your favorite food is steak

do you see where im going?

have a function to return text if a checkbox is checked

hope this help

colton22

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Adding data depending on checkbox checked or not


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT