I have been asking about this in the javascript forum and I was told that I should ask here. I have a funtion for my forum that simulates dice rolling. I would like to know how to make the results read only. Here is my funtion so far:
//Dice Button
function tag_dice()
{
var FoundErrors = '';
var Num = prompt("Please enter the number of dice", "1");
var Sides = prompt("Please enter the number of sides","2");
var Mod = prompt ("Please enter any modifiers","0");
var a = (Num*Sides)-Num;
var Rand = Math.random();
var b = Rand*a;
var Roun = Math.round(b);
var c = Number (Num) + Number (Mod);
var Roll = Number (Roun) + Number (c);
if (!Num) {
FoundErrors += "No dice?"
}
if (!Sides) {
FoundErrors += "That die cannot exist."
}
if (!Mod) {
FoundErrors += "Oops!"
}
if (FoundErrors) {
alert("Error! "+FoundErrors);
return;
}
if (Mod==0) {doInsert(Num+"d"+Sides+": "+Roll);}
else if (Mod>0) {doInsert (Num+"d"+Sides+"+"+Mod+": "+Roll);}
else if (Mod<0) {doInsert (Num+"d"+Sides+Mod+": "+Roll);}
}
if (dice >= userLV){
addButton("<input type='button' class='codebuttons' value='Dice' onmouseover='descript(\"Dice Roll (alt+r)\")' onclick='tag_dice()' accesskey='r' style='font-size: 10px' //> ");
temp = line(temp,ButtonCount,place);
So, is there any way for the doInsert values to be made readonly?
//Dice Button
function tag_dice()
{
var FoundErrors = '';
var Num = prompt("Please enter the number of dice", "1");
var Sides = prompt("Please enter the number of sides","2");
var Mod = prompt ("Please enter any modifiers","0");
var a = (Num*Sides)-Num;
var Rand = Math.random();
var b = Rand*a;
var Roun = Math.round(b);
var c = Number (Num) + Number (Mod);
var Roll = Number (Roun) + Number (c);
if (!Num) {
FoundErrors += "No dice?"
}
if (!Sides) {
FoundErrors += "That die cannot exist."
}
if (!Mod) {
FoundErrors += "Oops!"
}
if (FoundErrors) {
alert("Error! "+FoundErrors);
return;
}
if (Mod==0) {doInsert(Num+"d"+Sides+": "+Roll);}
else if (Mod>0) {doInsert (Num+"d"+Sides+"+"+Mod+": "+Roll);}
else if (Mod<0) {doInsert (Num+"d"+Sides+Mod+": "+Roll);}
}
if (dice >= userLV){
addButton("<input type='button' class='codebuttons' value='Dice' onmouseover='descript(\"Dice Roll (alt+r)\")' onclick='tag_dice()' accesskey='r' style='font-size: 10px' //> ");
temp = line(temp,ButtonCount,place);
So, is there any way for the doInsert values to be made readonly?