/    Sign up×
Community /Pin to ProfileBookmark

Comments From Selected Checkboxes Only

My goal: To create a way of matching the prime factors of Ben Joffe’s Prime Number Factorizer with a range of nominated divisions, e.g. #1: 0-5, #2: 6-25, #3: 26-125, #4: 126-625, etc.
For example 3, 13, 251 are factors of 9789. 3 belongs to #1, 13 to #2 and 251 to #4. I plan to have ten groups in all. In this case 7 of them would have no matches. Five are featured below.
Each range is given a text profile with a text field revealing key words when a matching number is indicated. Manual selection seems the best option here.
Later commentary will be added to these when a report is produced on a “newwin” window.
It is important that only the comments of those numbers with matches appear on the report and not a list of “undefined” messages along with unwanted commentary.
Radio buttons allow for only one to be selected from a group. Checkboxes, however, seem ideal due to the multiple choice aspect.
I would be very grateful for any help resolving the above issues.

<HTML>
<HEAD>
<script = “text/javascript”>
<!–

function matchPrimes(df) {

var range1 = df.range1.value;
var comment1 = df.comment1.value;

if (df.range1.value == checked)
{df.comment1.value = “red herring”;}
else (df.range1.value == null) {
return false;
}

var range2 = df.range2.value;
var comment2 = df.comment2.value;

if (df.range2.value == checked)
{df.comment2.value = “hot dog”;}
else (df.range2.value == null) {
return false;
}

var range3 = df.range3.value;
var comment3 = df.comment3.value;

if (df.range3.value == checked)
{df.comment3.value = “talk turkey”;}
else (df.range3.value == null) {
return false;
}

var range4 = df.range4.value;
var comment4 = df.comment4.value;

if (df.range4.value == checked)
{df.comment4.value = “brass knobs”;}
else (df.range4.value == null) {
return false;
}

var range5 = df.range5.value;
var comment5 = df.comment5.value;

if (df.range5.value == checked)
{df.comment5.value = “Jack Frost”;}
else (df.range5.value == null) {
return false;
}
}

// –>
</script>
</HEAD>
<BODY>

<form>
<input type = “checkbox” name=”range1″> Between 0 and 5 <input type=”text” name=”comment1″ size=20><br>
<input type = “checkbox” name=”range2″> Between 6 and 25 <input type=”text” name=”comment2″ size=20><br>
<input type = “checkbox” name=”range3″> Between 26 and 125 <input type=”text” name=”comment3″ size=20><br>
<input type = “checkbox” name=”range4″> Between 126 and 625 <input type=”text” name=”comment4″ size=20><br>
<input type = “checkbox” name=”range5″> Between 626 and 3125 <input type=”text” name=”comment5″ size=20><br>
<input type = “button” name=”selectMatches” value=”Match” onClick=”matchPrimes(this.form)”>
</form>

</BODY>
</HTML> ?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@KorAug 04.2006 — [B]disable[/B] the elements with unwanted/undefined values. The disabled elements do not send queries to the server. This is what you want?
Copy linkTweet thisAlerts:
@TimeTrackerauthorAug 04.2006 — Kor, everyone deserves to be given a break. What is stopping Romania from joining the EU? You are part of Eastern Europe. Could you please show me how to disable unwanted elements? By the way the above script does not pass values to the text field.
Copy linkTweet thisAlerts:
@KorAug 04.2006 — var el = document['formname'].elements;

for(var i=0;i<el.length;i++){

if(...condition){

el[i].disabled=true;

}

}
Copy linkTweet thisAlerts:
@TimeTrackerauthorAug 05.2006 — Kor, I am still at it. This is my first experience with coding checkboxes. Passing text to a text field or textarea for a checked box is something I am still learning to do. So far I have not seen any scripts on the web to help me here, but I will continue looking. From a very extensive list of variations I want to tailor reports to respond to certain selection criteria. It is important though to select the matching prime number range(s) first.
×

Success!

Help @TimeTracker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...