Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #35435

Re: HTML appearing on click

Newsgroups comp.lang.javascript
Subject Re: HTML appearing on click
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <ed695d9d-f3cb-41f6-8155-f512f3c00fd6@googlegroups.com> <5b575aa4$0$2944$e4fe514c@news.xs4all.nl>
Date 2018-07-24 23:54 +0200
Message-ID <XnsA929F3276C6E6eejj99@194.109.6.166> (permalink)

Show all headers | View raw


Luuk <luuk@invalid.lan> wrote on 24 Jul 2018 in comp.lang.javascript:

> On 24-7-2018 18:01, bit-naughty@hotmail.com wrote:
>> Suppose I have a button, which upon clicking, I want say, a form (or
>> some other HTML) to appear. Now this form could be fairly lengthy. Is
>> the only way to do it, to make the HTML in a separate file, then cut
>> and paste it into the site's code, and put a "var h = " before it, and
>> then innerHTML or appendChild "h" where I want? I imagine whatever
>> escaping is necessary in the HTML itself, after the "var h = ", would
>> be a nightmare? Or is there some better way to do it?
>> 
> 
> surround the stuff with:
> <span></span>, or  <div</div> with the apropriate tage to make it
> default not visible.
> 
> Make it visiable afte the click.
> 
> There are people who know more about javascript than i do, so i let them
> tell you if you need a SPAN or a DIV to do that ;)

<style>
myPart {display:block;border:2px black dotted;padding:8px;width:200px;}
myPart.noDisp {display:none};
</style>

<button 
onclick='document.querySelector("myPart").className="noDisp"'>
Do not display</button>
<br><br>

<button 
onclick='document.querySelector("myPart").className=""'>
Do display</button>
<br><br>

<myPart>
... lots of content ....<br>
... lots of content ....<br>
... lots of content ....<br>
... lots of content ....<br>
</myPart>



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

HTML appearing on click bit-naughty@hotmail.com - 2018-07-24 09:01 -0700
  Re: HTML appearing on click Luuk <luuk@invalid.lan> - 2018-07-24 18:58 +0200
    Re: HTML appearing on click "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-07-24 23:54 +0200
      Re: HTML appearing on click bit-naughty@hotmail.com - 2018-07-24 23:34 -0700
        Re: HTML appearing on click "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-07-25 09:05 +0200
        Re: HTML appearing on click Luuk <luuk@invalid.lan> - 2018-07-25 19:13 +0200
        Re: HTML appearing on click Maik Koenig <usenetspam@maikkoenig.de> - 2018-07-25 20:23 +0200

csiph-web