it's about the first code of Twey
but i fixed it..
i did
Code:
onkeyup="return displayMB(this.value, sizeOutput)"
instead of
Code:
onkeyup="return displayMB(this.value, 'sizeOutput')"
look at the sizeOutput .
I have another problem with this script
it seems like it doesn't remove all the children
my code now is:
Code:
<script type="text/javascript">
function displayMB(val, op) {
var opEl = op;
if(typeof op == 'string') opEl = document.getElementById(op);
for(var i = 0, e = opEl.childNodes; i < e.length; i++) // remove all children
opEl.removeChild(e[i]);
op.appendChild( // add text
document.createTextNode("It's ")
);
op.appendChild( // add a <b> element
document.createElement("b")
).appendChild( // add text to that <b> element
document.createTextNode(val * 1024 * 1024)
);
op.appendChild(
document.createTextNode(" MB")
);
}
</script>
the <input> and the <span>:
Code:
<input type=text name=MB onkeyup="return displayMB(this.value, sizeOutput)"> <span id="sizeOutput"></span>
you can check the bug it does here:
http://www.eyal.webkit.biz/MsU/admin.php
(password- admin)
because i don't know how to explain the problem...
Write a number at the <input> below to "How much MB?"
then delete the number or write another number.. it's getting crazy
what's the solution ?
Bookmarks