Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Codebutton function

Status
Not open for further replies.

adninja

Programmer
May 11, 2005
11
US
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?
 
I don't know why you were sent here. Javascript is not Java. Your question doesn't make sense in a pure Java context.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
... I've had a read of your post in the Javascript forum. They're telling you to do this server-side. In the Java world, that means using Java Server Pages (JSP) or Servlets. Either way, you should try forum695. But I'd rephrase the question to explain what you want to achieve, and that you're after a server-side solution.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top