experchange > javascript

grooveegeezer (10-06-18, 08:56 PM)
I have 2 boxes on screen, just 2 DIVs, 1 below the other, with whatever styling. In the top one I have a checkbox, saying "Sex", and the one below that, "Nationality". When "Sex" is clicked, I want another line appear BELOW it, with radio buttons for M and F. I'm managing that fairly OK with appendChild, but it's not FORCING THE "NATIONALITY" LINE DOWN FURTHER to make way for the "M" and "F!! Rather the M is appearing on TOP of the "Nationality"! Naturally, I don't want this. What do I do? (do I have to spend hours doing some kind of <table> shit, and will even *that* work?) How does one append HTML, exactly?
And also, if the "Sex" checkbox is clicked off (ie. the guy/girl doesn't want to declare his/her sex), the line must disappear, and "Nationality" moveUP to recover the now-blank space.... How, please?

Ooo my head hurts. Thanks.
Dr.Kral (10-07-18, 12:02 AM)
On Sat, 6 Oct 2018 11:56:02 -0700 (PDT), grooveegeezer wrote in
<d7b35f48-8702-4f4a-b040-f8248b82d048>:

>I have 2 boxes on screen, just 2 DIVs, 1 below the other, with whatever styling. In the top one I have a checkbox, saying "Sex", and the one below that, "Nationality". When "Sex" is clicked, I want another line appear BELOW it, with radio buttons for M and F. I'm managing that fairly OK with appendChild, but it's not FORCING THE "NATIONALITY" LINE DOWN FURTHER to make way for the "M" and "F!! Rather the M is appearing on TOP of the "Nationality"! Naturally, I don't want this. What do I do? (do I have to spend hours doing some kind of <table> shit, and will even *that* work?) How does one append HTML, exactly?
>And also, if the "Sex" checkbox is clicked off (ie. the guy/girl doesn't want to declare his/her sex), the line must disappear, and "Nationality" move UP to recover the now-blank space.... How, please?
>Ooo my head hurts. Thanks.


Forget tables.

Forget Append.

Remember boxes.

Define a class {display:none;}

Use mouse things like onclick, onblur and onfocus to call a js function
that changes className of the elements.
JJ (10-07-18, 09:09 AM)
On Sat, 6 Oct 2018 11:56:02 -0700 (PDT), grooveegeezer wrote:
> I have 2 boxes on screen, just 2 DIVs, 1 below the other, with whatever
> styling. In the top one I have a checkbox, saying "Sex", and the one
> below that, "Nationality". When "Sex" is clicked, I want another line
> appear BELOW it, with radio buttons for M and F. I'm managing that fairly
> OK with appendChild, but it's not FORCING THE "NATIONALITY" LINE DOWN
> FURTHER to make way for the "M" and "F!! Rather the M is appearing on
> TOP of the "Nationality"! Naturally, I don't want this. What do I do?


Chances are that the first DIV has a fixed height which long enough to fit
just the "Sex" checkbox. Extend it to fit the radio buttons too. If you want
the DIV height to be dynamic, don't specify the height. i.e. let it expand
automatically.

> And also, if the "Sex"
> checkbox is clicked off (ie. the guy/girl doesn't want to declare his/her
> sex), the line must disappear, and "Nationality" move UP to recover the
> now-blank space.... How, please?


If you use `appendChild()` to add the radio buttons, use `removeChild()` to
remove them. When creating each one of them, store it in an array, so that
you can retrieve them later when they need to be removed.
Osmo Saarikumpu (10-08-18, 03:44 PM)
On 06/10/2018 21:56, grooveegeezer wrote:
> ... And also, if the "Sex" checkbox is clicked off (ie. the guy/girl doesn't want to declare his/her sex)...


Why is my "sex" (default reproductive role, or lack of, or unwillingness
to answer) important to *you*? IOW, should you be asking that question
at all?
Evertjan. (10-08-18, 04:59 PM)
Osmo Saarikumpu <osmo> wrote on 08 Oct 2018 in
comp.lang.javascript:

> On 06/10/2018 21:56, grooveegeezer wrote:
>> ... And also, if the "Sex" checkbox is clicked off (ie. the guy/girl
>> doesn't want to declare his/her sex)...

> Why is my "sex" (default reproductive role, or lack of, or unwillingness
> to answer) important to *you*? IOW, should you be asking that question
> at all?


Because you should make it possible to answer yes/no/maybe/later/stop.
grooveegeezer (10-08-18, 07:21 PM)
On Sunday, 7 October 2018 03:32:43 UTC+5:30, Dr....@nyc.rr.com wrote:

> Define a class {display:none;}
> Use mouse things like onclick, onblur and onfocus to call a js function
> that changes className of the elements.


Bro, this is Not Working. I got the element *appearing on a click* just fine, but it doesn't push down the next line :(

Do I have to change the padding-top of the line below or something, manually?? Ugh.
Dr.Kral (10-08-18, 11:18 PM)
On Mon, 8 Oct 2018 10:21:54 -0700 (PDT), grooveegeezer wrote in
<11d04169-84dd-4c45-9870-5a5aa213da54>:

>On Sunday, 7 October 2018 03:32:43 UTC+5:30, Dr....@nyc.rr.com wrote:
>> Define a class {display:none;}
>> Use mouse things like onclick, onblur and onfocus to call a js function
>> that changes className of the elements.

>Bro, this is Not Working. I got the element *appearing on a click* just fine, but it doesn't push down the next line :(
>Do I have to change the padding-top of the line below or something, manually?? Ugh.


I can't see anything wrong with your code from here and neither can anyone
else.

I suggest that you study a bit for you need to learn some basic manners
(like 'thank you' and 'please'). Also learn about the basic box model for
html layout.

When you set things up assign (temporary) background colors to each box so
that you can see what spacing adjutants are required.
Thomas 'PointedEars' Lahn (10-09-18, 04:09 AM)
Osmo Saarikumpu wrote:
> On 06/10/2018 21:56, grooveegeezer wrote:
>> ... And also, if the "Sex" checkbox is clicked off (ie. the guy/girl doesn't want to declare his/her sex)...

> Why is my "sex" (default reproductive role, or lack of, or unwillingness
> to answer) important to *you*? IOW, should you be asking that question
> at all?


It can be important.

However, in the modern world, we have grown past the oversimplifying
distinction between only two gender identities, male and female (the
recognition of a third gender, neither male nor female (hijras), in e.g. the
Indian society since historical record keeping (Kama Sutra period, ca. 400
BCE to 200 CE) is evidence that not only non-binary gender identity is not a
new development, but this distinction has actually never been true for humans).

Users/customers will probably be offended, and will not use/buy, that do not
need to be offended, by the false dilemma put to them. The clueless OP
should follow the example of major service providers and give their
users/customers an appropriate selection of choices (at the very least,
“Other”).

PointedEars
Mark- (10-09-18, 05:38 AM)
Thomas 'PointedEars' Lahn wrote:

> Users/customers will probably be offended...
> PointedEars


Only folks walking around looking for something to cause them offense.
So I guess it includes PointedEars.
Thomas 'PointedEars' Lahn (10-10-18, 05:33 AM)
Mark- <nospam> wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Users/customers will probably be offended...


The sentence continues:

“… and will not use/buy, that do not need to be offended, […]”.

> Only folks walking around looking for something to cause them offense.


You have no clue what you are talking about. There is a good reason why,
for example, Facebook introduced the third choice, “User-defined”, some time
ago, with further possibility to specificy the pronoun that should be used
in references to the user (male: “him”; female: “her”; neutral: “him/her”).

> So I guess it includes PointedEars.


You are an idiot and a troll, which is basically the same thing.

Fortunately, this is appropriately reflected in your anti-social,
standards-violating, AUP-violating address munging, which makes it easy for
me to killfile you. (You are so stupid, you are not even worth investing
the time for an abuse report to aioe.org who should kick your sorry ass from
here to Andromeda for this.)

*PLONK*

F’up2 poster

PointedEars
Mark- (10-10-18, 03:09 PM)
Thomas 'PointedEars' Lahn wrote:

> There is a good reason
> why, for example, Facebook introduced the third choice,


You use the actions of FB to attempt to prove a point and I am the
idiot. HA

> You are an idiot and a troll, which is basically the same thing.


Perhaps but, I am not an ass.

Oh, and by the way, I was right, look at your response. You are always
mad and looking to be offended to justify being an ass to folks.
Similar Threads