473,626 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change text color onclick, and change it back - will post to DB

I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:

Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.

I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.

Anyone ever heard of something like this?

Mar 28 '07 #1
10 3576
"apparker" <ad**********@g mail.comwrote in message
news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:

Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.
You are in luck. Very recently someone threw together a nifty example.

http://groups.google.com/group/comp....9b47d50fc007b1
I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.

Anyone ever heard of something like this?
Sure, submit all your checkboxes (and the form) to your server-side script. Of course, if
checked, submit 1, if not, 0.

-Lost
Mar 29 '07 #2
On Mar 28, 8:37 pm, "-Lost" <missed-s...@comcast.ne twrote:
"apparker" <adamparke...@g mail.comwrote in message

news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:
Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.

You are in luck. Very recently someone threw together a nifty example.

http://groups.google.com/group/comp....wse_thread/thr...
I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.
Anyone ever heard of something like this?

Sure, submit all your checkboxes (and the form) to your server-side script. Of course, if
checked, submit 1, if not, 0.

-Lost
Wow that's great stuff... looks like the code is built around the
checkbox but could be altered for radios? Would it be possible to not
have the checkbox at all?

Mar 29 '07 #3
"apparker" <ad**********@g mail.comwrote in message
news:11******** **************@ o5g2000hsb.goog legroups.com...
On Mar 28, 8:37 pm, "-Lost" <missed-s...@comcast.ne twrote:
>"apparker" <adamparke...@g mail.comwrote in message

news:11******* *************** @b75g2000hsg.go oglegroups.com. ..
I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:
Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.

You are in luck. Very recently someone threw together a nifty example.

http://groups.google.com/group/comp....wse_thread/thr...
I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.
Anyone ever heard of something like this?

Sure, submit all your checkboxes (and the form) to your server-side script. Of course,
if
checked, submit 1, if not, 0.
>
Wow that's great stuff... looks like the code is built around the
checkbox but could be altered for radios?
I do not see why not.
Would it be possible to not
have the checkbox at all?
Visually? Sure, hide them via CSS (display: none; will destroy layout; visibility:
hidden; will preserve it).

You do not want to get rid of the checkboxes or radio inputs altogether. You would have
to code a scheme by which to trap 1 and 0s, and eventually send it to the server.

Keeping the form intact insures the ability to submit form contents.

-Lost

Mar 29 '07 #4
On Mar 28, 9:19 pm, "-Lost" <missed-s...@comcast.ne twrote:
"apparker" <adamparke...@g mail.comwrote in message

news:11******** **************@ o5g2000hsb.goog legroups.com...
On Mar 28, 8:37 pm, "-Lost" <missed-s...@comcast.ne twrote:
"apparker" <adamparke...@g mail.comwrote in message
>news:11******* *************** @b75g2000hsg.go oglegroups.com. ..
I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:
Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.
You are in luck. Very recently someone threw together a nifty example.
>http://groups.google.com/group/comp....wse_thread/thr...
I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.
Anyone ever heard of something like this?
Sure, submit all your checkboxes (and the form) to your server-side script. Of course,
if
checked, submit 1, if not, 0.
Wow that's great stuff... looks like the code is built around the
checkbox but could be altered for radios?

I do not see why not.
Would it be possible to not
have the checkbox at all?

Visually? Sure, hide them via CSS (display: none; will destroy layout; visibility:
hidden; will preserve it).

You do not want to get rid of the checkboxes or radio inputs altogether. You would have
to code a scheme by which to trap 1 and 0s, and eventually send it to the server.

Keeping the form intact insures the ability to submit form contents.

-Lost
perfect... love it, thanks so much!

Mar 29 '07 #5
On Mar 28, 9:37 pm, "apparker" <adamparke...@g mail.comwrote:
On Mar 28, 9:19 pm, "-Lost" <missed-s...@comcast.ne twrote:
"apparker" <adamparke...@g mail.comwrote in message
news:11******** **************@ o5g2000hsb.goog legroups.com...
On Mar 28, 8:37 pm, "-Lost" <missed-s...@comcast.ne twrote:
>"apparker" <adamparke...@g mail.comwrote in message
>>news:11****** *************** *@b75g2000hsg.g ooglegroups.com ...
I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:
Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.
>You are in luck. Very recently someone threw together a nifty example.
>>http://groups.google.com/group/comp....wse_thread/thr...
I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.
Anyone ever heard of something like this?
>Sure, submit all your checkboxes (and the form) to your server-side script. Of course,
>if
>checked, submit 1, if not, 0.
Wow that's great stuff... looks like the code is built around the
checkbox but could be altered for radios?
I do not see why not.
Would it be possible to not
have the checkbox at all?
Visually? Sure, hide them via CSS (display: none; will destroy layout; visibility:
hidden; will preserve it).
You do not want to get rid of the checkboxes or radio inputs altogether. You would have
to code a scheme by which to trap 1 and 0s, and eventually send it to the server.
Keeping the form intact insures the ability to submit form contents.
-Lost

perfect... love it, thanks so much!
another question, could other css styles interfere with this trick? I
got it working on a simple page, but not a complicated one with lots
of js and css styles.

Mar 29 '07 #6
"apparker" <ad**********@g mail.comwrote in message
news:11******** ************@o5 g2000hsb.google groups.com...
>>
I'm creating a new GUI for a program and it is for a medical exam.
There are so many different things to ask someone during a history it
wastes too much space to make checkboxes for everything so I had an
idea:
Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.
>You are in luck. Very recently someone threw together a nifty example.
>>http://groups.google.com/group/comp....wse_thread/thr...
I'd also like the event to post "1" or "0" to DB so the conditions can
be saved into the DB.
Anyone ever heard of something like this?
>Sure, submit all your checkboxes (and the form) to your server-side script. Of
course,
if
checked, submit 1, if not, 0.
Wow that's great stuff... looks like the code is built around the
checkbox but could be altered for radios?
I do not see why not.
Would it be possible to not
have the checkbox at all?
Visually? Sure, hide them via CSS (display: none; will destroy layout; visibility:
hidden; will preserve it).
You do not want to get rid of the checkboxes or radio inputs altogether. You would
have
to code a scheme by which to trap 1 and 0s, and eventually send it to the server.
Keeping the form intact insures the ability to submit form contents.
-Lost

perfect... love it, thanks so much!

another question, could other css styles interfere with this trick? I
got it working on a simple page, but not a complicated one with lots
of js and css styles.
In a word, yes.

-Lost
Mar 29 '07 #7
In comp.lang.javas cript message <11************ **********@b75g 2000hsg.go
oglegroups.com> , Wed, 28 Mar 2007 12:12:22, apparker
<ad**********@g mail.composted:
>Can I simply create a list of conditions and when the doctor clicks
them, they turn red? And clicking them again would make them default
again? This would really make the exam better since the doctor could
quickly glance at a page of hundreds of things and see what the person
has.
This illustrates the fundamentals of part of a possibility :-

<span onClick="alert( this.style.colo r=new Date()%0x100000 0)">hhh</a>

But test the human-interface aspects carefully before committing
yourself to the approach.

It could be useful to select with a checkbox, but re-colour the
associated text as a better indication.

Perhaps each condition should have four states -
Default unconsidered
Condition applies
Condition does not apply
Condition considered but undecided.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6
news:comp.lang. javascript FAQ <URL:http://www.jibbering.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Mar 29 '07 #8
-Lost wrote:
"apparker" <ad**********@g mail.comwrote in message
news:11******** ************@o5 g2000hsb.google groups.com...
>>>>>>I'm creating a new GUI for a program and it is for a medical exam.
>>There are so many different things to ask someone during a history it
>>wastes too much space to make checkboxes for everything so I had an
>>idea:
>>Can I simply create a list of conditions and when the doctor clicks
>>them, they turn red? And clicking them again would make them default
>>again? This would really make the exam better since the doctor could
>>quickly glance at a page of hundreds of things and see what the person
>>has.
>You are in luck. Very recently someone threw together a nifty example.
>http://groups.google.com/group/comp....wse_thread/thr...
Hi,

I asked the question leading to the response referenced above. Pasted
below is my modified script that processes radio buttons as well as
check boxes.

I ended up wrapping the input tag within the label tag and using
parentNode instead of nextSibling. nextSibling worked fine in the
example referenced above but can easily break if the input and label
tags are formatted on different lines (whitespace becomes a text node
and becomes the nextSibling).

As stated in the referenced thread, my form is pretty dense and may have
a hundred check boxes or radio buttons. The buff-ish background and
crimson colors seem to work well for me. I think the indentation below
is messed up from my translation from tabs to spaces -- sorry.

Roger
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>
highlight checkbox labels
</title>

<style type="text/css">
body {background: #FFEBCD; color: #382400; font-family:
verdana,arial,s ans-serif;}
..unchecked{ font-size: xx-small;}
..checked{ font-size: xx-small; color:crimson; font-weight:bold;}
..noBorder {font-size: xx-small;}
..numeric {text-align: right;}
</style>

<script type="text/javascript">
// Change the class name of a checkbox or radio button label to
highlight checked items
function setLabelStyle(x ){
if (x.checked){
x.parentNode.cl assName="checke d";
if (x.getAttribute ("type") == "radio") {
xName = x.name;
set = document.getEle mentsByName(xNa me);
for (var i=0;i<set.lengt h;i+=1) {
if (!set[i].checked) {
set[i].parentNode.cla ssName="uncheck ed"; }
}
}
}
else{
x.parentNode.cl assName="unchec ked";
}
}

</script>

</head>
<body>
<form action="someact ion">
<center>
<table>
<tr>
<td>
<label class="unchecke d">
<input type="checkbox" id="check1"
onclick="setLab elStyle(this);" >
Abraided
</label>
<br />
<label class="unchecke d">
<input type="checkbox" id="check2"
onclick="setLab elStyle(this);" >
Incised
</label>
<br />
<label class="unchecke d">
<input type="checkbox" id="check3"
onclick="setLab elStyle(this);" >
Pecked
</label>
<br />
<label class="unchecke d">
<input type="checkbox" id="check4"
onclick="setLab elStyle(this);" >
Scratched
</label>
<br />
</td>

<td>
<label class="unchecke d">
<input type="radio" id="check21" name="myradio"
onclick="setLab elStyle(this);" >
Abraided
</label>
<br />
<label class="unchecke d">
<input type="radio" id="check22" name="myradio"
onclick="setLab elStyle(this);" >
Incised
</label>
<br />
<label class="unchecke d">
<input type="radio" id="check23" name="myradio"
onclick="setLab elStyle(this);" >
Pecked
</label>
<br />
<label class="unchecke d">
<input type="radio" id="check24" name="myradio"
onclick="setLab elStyle(this);" >
Scratched
</label>
<br />
</td>
</tr>
</table>

</center>
</form>
</body>
</html>
Mar 31 '07 #9
ASM
apparker a écrit :
On Mar 28, 8:37 pm, "-Lost" <missed-s...@comcast.ne twrote:
>"apparker" <adamparke...@g mail.comwrote in message

Wow that's great stuff... looks like the code is built around the
checkbox but could be altered for radios? Would it be possible to not
have the checkbox at all?
see my examples :

http://stephane.moriaux.perso.wanado...athologies.htm
http://stephane.moriaux.perso.wanado...ogies_form.htm
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Mar 31 '07 #10

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

Similar topics

3
17076
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited link and the text of the link under the cursor are red. All other links should be white. The problem with the construction above is that a visited link remains for the rest of the session red regardless wether it was visited 17 clicks back in...
4
2608
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an QA tested for a new year release. I don't think that going to prove practical, but there is no harm in trying :) and some serious family commitments. But it has to be done soon so this is stage one. Mike Winter provided an extensive list of...
4
20993
by: JohnSouth104 | last post by:
Hi I want to warn the user that changing the selected item in a pull-down will clear some data he has already entered in a file download box. I've tried using confirm() to return true or false with a line such as: onchange="return(confirm('proceed Yes or No')))" but it always stops the change.
28
2590
by: Randy Starkey | last post by:
Hi, Does anyone know where I can get a script that show a little plus sign after a line of text, that when you click the plus sign, more text is revealed on that same page, like a continuing paragraph. This will be on a web page. Thanks! --Randy Starkey
2
3095
by: Cranky | last post by:
Ok, here is my scenario: I need to input numbers using my handheld IPAQ. I figured out how to create an online numeric keypad for inputting numbers into an input field, what I need to know is how I can have JS switch from one input field to another based on me clicking in the empty box. Here is my code: ########## Start of code ################### <html> <head>
10
6072
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
4
2919
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of text and I can't find the error on why it isn't working. Any help is greatly appreciated. Here is the form
18
7754
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of messages to be displayed, the other button collapses that same thread. Works fine. I was asked if I can just make it one button. I've played around with a few java scripts. they seem to all work fine until i put my added codes in the text line...
5
4455
by: thatcollegeguy | last post by:
Below are my 3php and 2js files. I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know if I have the entirely wrong approach, but my code is below. Any or all help is appreciated! What currently happens is that the getdivision.php script works perfectly and gives me an entire table of correct data. The problem is that when I click...
0
8262
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
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
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
8364
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
7192
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...
1
6122
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
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
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
1
1807
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.