Quote: "a journey of a thousand miles begins with a single step"
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
Quote: "a journey of a thousand miles begins with a single step"
I don't even know the first step, lols.
I understand that this:
Code:
var ckbs = document.getElementsByTagName('input');
for (var i=0; i < ckbs.length; i++) {
if (ckbs[i].type == 'checkbox') {
// do something
}
}
is calling to all checkboxes on the page, however I need to change the, lets sayfor example if Obj2012-Check is checked then Obj2012 class needs to change but if Obj2011-Check is checked then Obj2011 call needs to change
var ckbs = document.getElementsByTagName('input');
for (var i=0; i < ckbs.length; i++) {
if (ckbs[i].type == 'checkbox') {
if ((ckbs[i].id).indexOf('Obj') + 1) {
// that is, if the id includes 'Obj'
// you'll need other string functions if you have to check
// other parts of the id
if (ckbs[i].checked) {
ckbs[i].className = "wibble";
} // else: see a previous post of mine
}
}
}
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
Last edited by AndrewGSW; 01-04-2013 at 10:07 PM..
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
Okay, the problem is that you are *NOT* dealing with an ordinary checkbox.
Since you are using that checkbox.js code, *it* is taking over the onclick method of your checkboxes! So anything you try to add to *also* handle the onclick's is going to either (a) interfere with the checkbox.js code or (b) OVERWRITE the checkbox.js code or (c) get itself overwritten by the checkbox.js code.
The most practical things to do to fix this are either (a) stop using checkbox.js and write your own equivalent code or (b) modify checkbox.js to also change the class upon the onclick.
Which do you choose?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
To be honest, I do not even know how the checkbox.js works so I won't be able to program my own, well, at this moment in time anyway.
There are also quite a lot of these to implement. I'll go for your best option though as you have helped so much and are more experienced in the field.
Personally, I feel that checkbox.js code is needlessly overcomplicated. I'd prefer to rip it out and write my own.
Do you *care* that a person without JavaScript would then see ordinary checkboxes, as with checkbox.js? Of course not. Your page won't even BEGIN to run without JS.
So let me toss out checkbox.js and make it tons simpler.
Why do you want class to change because of checked, by the by?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
This will lead on to showing the markers on the map. If they've not checked that they have completed 2011 for example or not checked everything in-side to auto-check the 2011 objectives, the 2012 objectives will not show on the map as they don't be available.
I'm hoping once I know a basic of both, the showing of images on the map and these checkboxes I can get started on doing loads myself. There are some big array's for myself to complete and quite a lot of research to try and find the previous years objectives although these do not get removed and you do a continuation, these should be easy to find but aren't as the help websites out there are rubbish, hence why I am working on this and meant to be working on other things.
OPs work though is likely to be more specific to you.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS