PDA

View Full Version : A.S.A.P - - - hexa prob-look in!


solal
11-29-2002, 03:45 PM
could someone tell me the problem of this HTML page?

* i'm trying to do in javascript a page that converts regular number to hexadecimal!
and this page does not run!
why?


<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
function makeArray() {
for (i = 0; i<makeArray.arguments.length; i++)
this[i] = makeArray.arguments[i];
}

var convert = new

makeArray('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M ','N','O','P','Q','R','S'

,'T','U','V','W','X','Y','Z');

function returnBase(ber,16) {
scan(ber);
if (ber < 16)
var output = convert[ber];
else {
var MSD = '' + Math.floor(ber / 16);
var LSD = ber - MSD*16;
}
if (MSD >= 16)
var output = returnBase(MSD,16) + convert[LSD];
else {
var output = convert[MSD] + convert[LSD];
//return output;
document.solal.re.value=output;}
}

}
</script>

</HEAD>

<BODY>
<form name="solal">
<input type="text" name="ber">



<input type="button" value="העבר" onclick="returnBase()">



<input type="reset">



<input type="text" name="re">
</form>
</BODY>
</HTML>

Philip M
11-29-2002, 06:18 PM
No idea why your script does not work, but suggest you have a look at

http://javascript.internet.com/equivalents/base-converter.html