[Javascript] Changing the Font Size in an Alert box.
Steve
extstarrfam at cox-internet.com
Wed Mar 27 01:42:39 CST 2002
I've tried a lot of thing so as to change the font size
of an Alert box and got some strange results but I did
not succeed. How do you change the font size of an
alert box? Here is the code I working on:
<head><title>Decimal to Binary</title>
<script language="JavaScript1.3"
TYPE="text/javascript">
<!--
// Declare Global variable
var iNumber = 0;
var Quot = 0;
var Remainder = 0;
var Result = 0;
var stringBinary = new String(); // Creating a string
object
function convertDecimal(iNumber) {
for(var i = 1; i <= 32; i++) {
//if (iNumber == 0) { //Use this to elimate extra
zeros
//break;
//}
Remainder = iNumber % 2;
// Exp: 1 = 9 % 2
iNumber = (iNumber - Remainder) / 2;
// Exp: 4 = (9 - 1) / 2
if(Remainder == 0) {
stringBinary = "0" + stringBinary;
// The new binary number is con-
// cantanated to the left side of the
// string.
}
if(Remainder == 1) {
stringBinary = "1" + stringBinary;
}
} // This closes the For...Next loop
} // This closes the function
function processEntry(iNumber) {
iNumber = document.entryForm.numEntry.value
if(iNumber == 0) {
alert("A zero entry is not allow.");
} else {
convertDecimal(iNumber); // This passes the value of
x to iNumber
alert("The binary equivalent is: " + stringBinary);
// HERE IS THE ALERT BOX
}
}
// -->
</script>
</head>
<body>
<form name="entryForm">
<p>Enty a number no more than 5 digits in length:
<input type="text" name="numEntry" size="5"
maxlength="5" style="text-align: right;">
<input type="submit" name="process" value="Process"
onClick="processEntry(iNumber)"></p>
</form>
</body>
</html>
More information about the Javascript
mailing list