chrismiceli
12-28-2002, 05:53 AM
i have this script for fun with binary, and i need to add a line after ever 16 bits
<html>
<head>
<title>bianary</title>
<script type="text/javascript">
i = 0;
function hello() {
document.getElementById("spanname").innerText += Math.round(Math.random());
++i;
if (i != 256) {
hello();
}
}
</script>
</head>
<body>
<input type="button" value="binary" onClick="hello()"><br>
<span id="spanname"></span>
</body>
</html>
i want to add a line after every 16 random numbers, i tried this but it didn't work
test = document.getElementById("spanname").innerText
test.toString()
test = test.length /16
test = test.toString();
if (test.indexOf(".") == -1) {
test += "\n" //i also tried <br> but no luck
any help would be appreciated
<html>
<head>
<title>bianary</title>
<script type="text/javascript">
i = 0;
function hello() {
document.getElementById("spanname").innerText += Math.round(Math.random());
++i;
if (i != 256) {
hello();
}
}
</script>
</head>
<body>
<input type="button" value="binary" onClick="hello()"><br>
<span id="spanname"></span>
</body>
</html>
i want to add a line after every 16 random numbers, i tried this but it didn't work
test = document.getElementById("spanname").innerText
test.toString()
test = test.length /16
test = test.toString();
if (test.indexOf(".") == -1) {
test += "\n" //i also tried <br> but no luck
any help would be appreciated