Javascript-форум (https://javascript.ru/forum/)
-   Events/DOM/Window (https://javascript.ru/forum/events/)
-   -   Не уменьщается значение горизонтального тулбара. (https://javascript.ru/forum/events/69311-ne-umenshhaetsya-znachenie-gorizontalnogo-tulbara.html)

Steven_Kirke 13.06.2017 17:12

Не уменьщается значение горизонтального тулбара.
 
Всем добрый день. Ребята, подскажите как сделать уменьшение тулбара, что то вообще сообразить не могу.
// =====================================
var s=200;
var timer_is_on=0;
var t;
function timedCount()
{
create_line();
document.getElementById('txt').value=s;
document.getElementById('test').value=s;
s = s-10;
t=setTimeout("timedCount()",1000);

}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
function create_line()
{
var c = document.getElementById("newCanvas");
var ctx = c.getContext("2d");
ctx.strokeStyle = "rgb(0, 255, 0)";
ctx.beginPath();
ctx.lineWidth = 12;
ctx.lineCap = "round";
ctx.moveTo(20, 40);
ctx.lineTo(s, 40);
ctx.stroke();

}
// =====================================

</script>
<input type="text" id="txt" >
<input type="button" value="?????? ??????!" onclick="doTimer()" />
<input type="button" value="?????????? ??????!" onclick="stopCount()" />
<input type="text" id="test">

j0hnik 13.06.2017 21:30

<input type="text" id="txt" style="width: 30px">
<input type="button" value="?????? ??????!" onclick="doTimer()" style="width: 30px" />
<input type="button" value="?????????? ??????!" onclick="stopCount()" style="width: 30px"/>
<input type="text" id="test" style="width: 30px">

достаточно маленький? :thanks:

Steven_Kirke 14.06.2017 08:43

Да это я убрал.

Dilettante_Pro 14.06.2017 10:48

Долго думал, но так и не понял сути вопроса... На всякий случай

<canvas id="newCanvas" style="width:250px;heigth:250px"></canvas>
<input type="text" id="txt" style="width:30px;">
<input type="button" value="start count!" onclick="doTimer()" />
<input type="button" value="stop count!" onclick="stopCount()" />
<input type="text" id="test" style="width:30px;">

<script>
var s=200;
var timer_is_on=0;
var t;
function timedCount()
{
create_line();
document.getElementById('txt').value=s;
document.getElementById('test').value=s;
s = s-10;
t=setTimeout("timedCount()",1000);

}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
function create_line()
{
var c = document.getElementById("newCanvas");
var ctx = c.getContext("2d");
ctx.clearRect(0, 0, 249, 249);
ctx.strokeStyle = "rgb(0, 255, 0)";
ctx.beginPath();
ctx.lineWidth = 12;
ctx.lineCap = "round";
ctx.moveTo(20, 40);
ctx.lineTo(s, 40);
ctx.stroke();

}
// =====================================

</script>


Часовой пояс GMT +3, время: 19:15.