Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Off-Topic > Javascript help! got the code, need to reverse effects.
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
20.Sep: FOURTH CHAPTER IN `HISTORY OF...` PUBLISHED
13.Sep: NEWS ON THE FLY
06.Sep: APOLYTON DONATES TO HURRICANE RELIEF

bottom of page
   - CIVILIZATION 3 $9.99 - CIVILIZATION 2 from $6.95 - CIVILIZATION 2 from $4.25 - ALPHA CENTAURI + ALIEN CROSSFIRE (laptop collection) from $19.99 - ALPHA CENTAURI PC $9.99 -->
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Sn00py is offline Sn00py
King
From New Zealand
Aug 2001
time: 13:37
  Old Post 18-08-2005 10:47 Visit Sn00py's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Javascript help! got the code, need to reverse effects. Support Apolyton

This is the code:

At the moment, it disables checkboxes via a master checkbox.

But what I want it to do is ENABLE the checkboxes via the master checkbox.

Also, the master checkbox has to be a radio, or at least function like a radio.

Any help?

(and yes, I have tried coding forums and sites, I'm desperate to get this sorted out today!)

edit: code tags aren't working

=======================================
// The check box group is definded by the check boxes with a parent of the same title
// A check box with a parent node of the group title suffixed with 'f7_Master'
// is used to set the disable status of the other check boxes
// Example HTML Code for one group
//
//

//

//

//


//
// Master

//


// or to force the disabled group into a checked state of checked use
//
// Master

//


// or to force the disabled group into a checked state of unchecked use
//
// Master

//




// Each group is initialised from a onload event
//
// where

// All variable, function etc. names are prefixed with 'f7_' to minimise conflicts with other javascripts


var f7_cks;

function f7_DisableCBGroup(){
f7_cks=document.getElementsByTagName('INPUT');
for (f7_0=0;f7_0 if (f7_cks[f7_0].type=='checkbox'){
if (f7_cks[f7_0].parentNode.title.match('f7_Master')){
f7_cks[f7_0].parentNode.state=f7_cks[f7_0].parentNode.title.split('f7_Master')[1];
f7_cks[f7_0].parentNode.title=f7_cks[f7_0].parentNode.title.replace(f7_cks[f7_0].parentNode.state,'')
f7_Disable(f7_cks[f7_0])
f7_cks[f7_0].onclick=function(){ f7_Disable(this); }
}
}
}
}

function f7_Disable(f7_obj){
for (f7_1=0;f7_1 if (f7_cks[f7_1].parentNode.title==f7_obj.parentNode.title.replace('f7_Master','')){
if (f7_obj.checked){
f7_cks[f7_1].setAttribute('disabled',true)
if (f7_obj.parentNode.state=='CHECK'){
f7_cks[f7_1].checked=true;
}
if (f7_obj.parentNode.state=='UNCHECK'){
f7_cks[f7_1].checked=false;
}
}
else {
f7_cks[f7_1].removeAttribute('disabled')
}
}
}
}


//-->
=======================================

Urban Ranger is offline Urban Ranger
Apolyton Duke of Off-Topic

Donate to the Red Cross
The City State of Noosphere, CPA special envoy
May 1999
time: 13:37
  Old Post 18-08-2005 11:31
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Full PM-box? Change here!

Set the checkboxes' initially to disabled. Set a script associated on the master checkbox's onclick handler. It checks the state of the master checkbox - if checked, enables other checkboxes, if unchecked, disables other checkboxes.

Sn00py is offline Sn00py
King
From New Zealand
Aug 2001
time: 13:37
  Old Post 18-08-2005 12:13 Visit Sn00py's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy Civilization 2

Yes, that's the simple way of doing it.

But then multiply this by 4 and you will face problems.

This form has 4 sections, and in each section are 2 checkboxes.

A section has to be enabled before the 2 checkboxes in the corresponding section are enabled for use.

Urban Ranger is offline Urban Ranger
Apolyton Duke of Off-Topic

Donate to the Red Cross
The City State of Noosphere, CPA special envoy
May 1999
time: 13:37
  Old Post 18-08-2005 12:48
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

Yeah, I can see it getting tedious, though still pretty simple. Copying and pasting sections of code plus some minor changes (names of elements) should do the trick.

Sn00py is offline Sn00py
King
From New Zealand
Aug 2001
time: 13:37
  Old Post 18-08-2005 13:17 Visit Sn00py's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Tired of ads?

I said stuff it, and did some experimenting.

And lo and behold, it worked.

WOO!!

And I know about .05% of javascript.

edit: ok, code won't display, and I can't be arsed to work out why.

Now I just have to set it for the other 3 Options!

YEAH! Now I see where programmers get their kicks!

code:

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:37.
Apolyton Time is 00:37.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0344 seconds (87.90% PHP - 12.10% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net