Den fredag 11 september 2015 kl. 12:29:11 UTC+2 skrev Evertjan.:
> jonas.thornvall@gmail.com wrote on 11 Sep 2015 in comp.lang.javascript:
>
> >> if (debug=='on') console.log('value of a is: ' + a);
> >>
> >> > It would be neat if one could use a none Javscript symbol at start
> >> > of line
> >>
> >> What is a "none Javscript symbol"?
> >> A "non-Javascript symbol"?
> >> A "known Javascript symbol"?
> >
> > Well i was thinking of a reserved unicode ascii combination at start of
> > row, for example &% could signify 0 and 1 and thus we could have a lot
> > of optional execution paths by set &=1 or &=0 for flagged execution.
>
> Why don't you answer my Q above?
>
> There is no start-of-line or start-of-row in Javascript,
> Javascript is just aa script of statements.
>
> > Now we would have alot of optional executional choices that can be
> > steered directly from form by reading a checkbox to set the flag for.
> >
> > &,%,&%,%&,%%,&& and so on.
>
> You can muse whatever you like, but Javascript is just Javascript.
>
> >> I don't think so, why would you want "traces of operation" on paper?
>
> > No i meant online in HTML form, let say you have a calculus system and
> > you > like to chose the detail level of presentation of the calculation.
>
> "online" has nothing to do with it.
> Do you mean html as processed by a modern browser?
>
> No, clientside javascript can only do what it does,
>
>
>
> >> if (debug=='on') { };
> >>
> >> > That way you could swithch between extensive printouts, or just
> >> > result.
> >>
> >> You clould also just disregard the console,
> >> or have your printer throw the paper directly into the trach-bin.
> >>
> >> > How is this usually resolved in Javascript,
> >
> > This is not just for debug purposes but to steer detail level of a
> > calculation or a salary specificaion.
>
> You should use the DOM for that, and steer the DOM with your Javascript.
>
> > I do realise that it is probably a database query,
>
> I don't think so.
>
> > but there must be
> > alot of realtime systems nowadays that is overwatched from
> > webinterfaces?
>
> This above sentence means nothing to me.
>
> > And there you may want to specify detail level of information for the
> > process you want to study?
>
> =======================================
>
> Well, try the following using DOM by clientside Javascript:
>
> <!DOCTYPE html>
> <span class='level1'>text 1 text</span><br>
> <span class='level3'>text 3 text</span><br>
> <span class='level2'>text 2 text</span><br>
> <span class='level3'>text 3 text</span>
>
>
> <script type='text/javascript'>
>
> var Iwantlevel3gone = true;
>
> if (Iwantlevel3gone) {
> var temp = document.querySelectorAll('.level3');
> for (i in temp) temp[i].style.display = 'none';
> };
>
> </script>
>
> ==========================
>
> Or use serverside Javascript by reloading the page:
>
> <%
> var level1, level2, level3, Iwantlevel3gone = true;
>
> if (Iwantlevel3gone) {
> level1 = true;
> level2 = true;
> level3 = false;
> };
> %>
>
> <% if (level2) { %>text 1 text<% } %><br>
> <% if (level3) { %>text 3 text<% } %><br>
> <% if (level2) { %>text 2 text<% } %><br>
> <% if (level3) { %>text 3 text<% } %>
>
> [not tested]
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
You are correct Janevert i misunderstood, your example work perfectly fine with forms as was as console.
So if(debugOne), if(debugTwo) and so on it will be.