Add a second button to your double.html page. Each time this new button is clicked, the value in the text box named numberBox should be halved. For example, if the box contains the number 1,024, clicking the button should reduce the number to 512.

If you start with a value of 1,024 in the text box, how many times must you click the halving button before the displayed value is reduced to 1? How many times if you start with 2,048?


```







Doubling





onclick="number=parseFloat(document.getElementById('numberBox').value); double=2*number; document.getElementById('numberBox').value=double;">
onclick="number=parseFloat(document.getElementById('numberBox').value); half=number/2; document.getElementById('numberBox').value=half;">


```

1024 is reduced to 1 in 10 clicks.
2048 is reduced to 1 in 11 clicks.

Computer Science & Information Technology

You might also like to view...

In the accompanying figure, item 2 points to the ____.

A. horizontal and vertical rulers B. margin guides C. document boarders D. top and side layers

Computer Science & Information Technology

Explain the 7-bit, 8-bit and 16-bit codes.

What will be an ideal response?

Computer Science & Information Technology

JPEG is a format that expands graphics to increase their file size, which means the file takes up less storage space.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

One or more exchanges are housed in a physical building called a(n) ____________________ where individual voice circuits all come together.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology