I have several controls, to be all alike, and the first has
been upgraded to (with these 3 inputs on ONE line) :-
L
<input type=button value="-" onclick="this.nextSibling.value--;Draw()"> <input name=L type=text size=4 value=13>
<input type=button value="+" onclick="this.previousSibling.value++;Draw()">
One of the effects of Draw() is reading the control.
Is there a better approach nowadays - a single control element,
perhaps? It must accept typed values in L, and a slider would
either be too long or give insufficient resolution.
I have several controls, to be all alike, and the first has
been upgraded to (with these 3 inputs on ONE line) :-
L
<input type=button value="-" onclick="this.nextSibling.value--;Draw()"> <input name=L type=text size=4 value=13>
<input type=button value="+" onclick="this.previousSibling.value++;Draw
One of the effects of Draw() is reading the control.
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
Is there a better approach nowadays - a single control element,
perhaps? It must accept typed values in L, and a slider would
either be too long or give insufficient resolution.
FYI, I hope to adjust the above onclicks so that they ALL are
"Nudge(this, Bool)" where Bool means previous or next; or even
make it look both ways for its numeric input control.
JRS wrote on 15 Nov 2018 in comp.lang.javascript:
I have several controls, to be all alike, and the first has
been upgraded to (with these 3 inputs on ONE line) :-
L
<input type=button value="-" onclick="this.nextSibling.value--;Draw()"> <input name=L type=text size=4 value=13>
<input type=button value="+" onclick="this.previousSibling.value++;Draw
One of the effects of Draw() is reading the control.
This only works in modern browsers,
if the source-code[!] is not split in multiple lines
in a way that generate empty text nodes,
and
I would want to know which node and
with what value draw() receives,
so try:
======================
<script>
const drawIt = (t) => {
if (t.value=='+') {
t.previousSibling.value++;
} else {
t.nextSibling.value--;
};
draw(t);
};
</script>
<input type=button value="-" onclick="drawIt(this);"
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
===========
Is there a better approach nowadays - a single control element,
perhaps? It must accept typed values in L, and a slider would
either be too long or give insufficient resolution.
<input type="number" value="13" step="1" onmouseup="draw(this)">
However, see: <https://caniuse.com/#search=input%20type>
<input type="number" value="13" step="1" onmouseup="draw(this)">
Rem acu tetigisti, as they would write elsewhere; I think I first met it
in something by P.G.Wodehouse.
However, see: <https://caniuse.com/#search=input%20type>
OK in Firefox, though size=4 seems not to work;
JRS wrote on 15 Nov 2018 in comp.lang.javascript:
<input type="number" value="13" step="1" onmouseup="draw(this)">
Rem acu tetigisti, as they would write elsewhere; I think I first met it
in something by P.G.Wodehouse.
However, see: <https://caniuse.com/#search=input%20type>
OK in Firefox, though size=4 seems not to work;
Use css styles for width in px, not the old html attribute
Use css styles for width in px, not the old html attribute
No. I don't want the width of a text control in px; in this
case I want room for exactly four number characters, monospace
- the overall width is not important. I am already using
.EM4 { width: 4em; } .
JRS wrote on 16 Nov 2018 in comp.lang.javascript:
Use css styles for width in px, not the old html attribute
No. I don't want the width of a text control in px; in this
case I want room for exactly four number characters, monospace
- the overall width is not important. I am already using
.EM4 { width: 4em; } .
That is, imho, not the task of HTML5 cum CSS3.
Better limit the integer number to -999 to 9999 in JS.
On Friday, November 16, 2018 at 11:58:50 AM UTC, Evertjan. wrote:
JRS wrote on 16 Nov 2018 in comp.lang.javascript:
Use css styles for width in px, not the old html attribute
No. I don't want the width of a text control in px; in this
case I want room for exactly four number characters, monospace
- the overall width is not important. I am already using
.EM4 { width: 4em; } .
That is, imho, not the task of HTML5 cum CSS3.
Better limit the integer number to -999 to 9999 in JS.
It's not an integer; it is a percentage inner margin, stepping by 0.5
- but one can type in whatever suits. A resolution of 0.5% should
serve, 0.1% is the greatest reasonable accuracy. A negative value
would correspond to printing outside the printer's printable area.
Typically, about 10% would be used, currently. A floating string,
such as "1e1", can be typed in; but after inc/dec I see 10.5/9.5 .
There is no need to constrain the values, since their effect is
readily enough visible. Octal is not recognised; hexadecimal is not understood.
JRS wrote on 16 Nov 2018 in comp.lang.javascript:
You should write and print numeric values as formatted strings.
Algol taught me that.
Don't be dependend on the quirks of operating systems and browsers.
On Friday, November 16, 2018 at 9:33:46 PM UTC, Evertjan. wrote:
JRS wrote on 16 Nov 2018 in comp.lang.javascript:
You should write and print numeric values as formatted strings.
Algol taught me that.
60 or 68? I knew one of the authors of the Algol 60 Report, and I have
a printed copy. <script type="text/Algol##"> would be nice, if widely implemented.
Don't be dependend on the quirks of operating systems and browsers.
Knowing them means that they can be avoided.
I require this page to be capable of running in Firefox, as
Firefox debugging is best for me. But, as a bonus, I would
like the page to read and write a file, as an editor does.
Trying <input type=file proved a disappointment;
<input type=button value="-" onclick="drawIt(this);"Hello,
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
<input id='result1' size=4 value=13 readonly</pre>
<input type=button value="+" onclick="drawIt(this);">
(origin in comp.lang.javascript)
On 15th November 2018 at 16:51, Evertjan wrote :
<input type=button value="-" onclick="drawIt(this);"Hello,
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
You will get this better displayed in a mail/news client inside a PRE
tag, as it will avoid second and third lines to be considered as
quotations.
<pre>
<input type=button value="-" onclick="drawIt(this);"
<input id='result1' size=4 value=13 readonly</pre>
<input type=button value="+" onclick="drawIt(this);">
On 15th November 2018 at 16:51, Evertjan wrote :
<input type=button value="-" onclick="drawIt(this);"Hello,
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
You will get this better displayed in a mail/news client inside a PRE
tag, as it will avoid second and third lines to be considered as quotations.
<pre>--
<input type=button value="-" onclick="drawIt(this);"
<input id='result1' size=4 value=13 readonly</pre>
<input type=button value="+" onclick="drawIt(this);">
JRS wrote on 17 Nov 2018 in comp.lang.javascript:
On Friday, November 16, 2018 at 9:33:46 PM UTC, Evertjan. wrote:
JRS wrote on 16 Nov 2018 in comp.lang.javascript:
You should write and print numeric values as formatted strings.
Algol taught me that.
60 or 68? I knew one of the authors of the Algol 60 Report, and I have
a printed copy. <script type="text/Algol##"> would be nice, if widely implemented.
I don't remember, I only had this booklet about Algol,
and that printing to the screen or to paper were not something default,
but required a command, and that that command needed to specify the string type.
Client-side accessing a file should be and is forbidden for browsers.
I once saw a French "Algol 60" manual in Blackwell's - it was not standards-compliant, as the reserved words had been translated
into French.
On 15th November 2018 at 16:51, Evertjan wrote :
<input type=button value="-" onclick="drawIt(this);"
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
You will get this better displayed in a mail/news client inside a PRE
tag, as it will avoid second and third lines to be considered as quotations.
<pre>
<input type=button value="-" onclick="drawIt(this);"
<input id='result1' size=4 value=13 readonly</pre>
<input type=button value="+" onclick="drawIt(this);">
Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 18 Nov 2018 in comp.lang.javascript:
"><input id='result1'"
This "><" in the html code line
was ment by me to prevent text-node insertion
while keeping the linee short enough
for Usenet newsreader implementations.
Gloops <gloops@zailes.invalid.org.invalid> wrote on 18 Nov 2018 in comp.lang.javascript:
On 15th November 2018 at 16:51, Evertjan wrote :
<input type=button value="-" onclick="drawIt(this);"Hello,
<input id='result1' size=4 value=13 readonly
<input type=button value="+" onclick="drawIt(this);">
You will get this better displayed in a mail/news client inside a PRE
tag, as it will avoid second and third lines to be considered as
quotations.
<pre>
<input type=button value="-" onclick="drawIt(this);"
<input id='result1' size=4 value=13 readonly</pre>
<input type=button value="+" onclick="drawIt(this);">
What do you mean by: "considered as quotations" ???
By whom and what would that matter?
Remember:
<pre>
is just a shorthand for
<div style='font-family:monospace;white-space: pre;'>
(origine dans comp.lang.javascript)
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,025 |
Nodes: | 10 (0 / 10) |
Uptime: | 138:47:49 |
Calls: | 13,303 |
Calls today: | 4 |
Files: | 186,574 |
D/L today: |
1,384 files (412M bytes) |
Messages: | 3,350,220 |