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!

doInsert readonly

Status
Not open for further replies.

adninja

Programmer
May 11, 2005
11
US
I was wondering if there was a way to make the text a js button puts in the text area of my forum readonly, and maybe in another font? I am just looking for a way to keep people from cheating when using my dice roller. I can always check their posts to see if they actualy used the button or if they wrote it out themselves.
 
Code:
<input type=text id=blahText readonly>
<input type=button value='click me' onclick='document.getElementById("blahText").value = "you cant change this"'>

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
[banghead]
 
Except if the are running Firefox with a DOM inspector and they change the values...

If it is essesntial that they cannot cheat, use a server-side routine to generate the number, and post it back to them. That way you'll know what number they genuinely got.

Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
I agree with Dan. A server-side routine should be used if this is a serious application. In any browser I've seen you can change anything by typing JavaScript into the address bar:
Code:
javascript:void(document.getElementById("yourField").value='My New Value!')

Adam

There are only 10 types of people in the world: Those who understand binary, and those who don't
 
Weel, this is only for a play by post RPG that I am working on. I already have a routine that generates the number and posts it once they input the necessary values. I can always check their posts to see if the result was read only (once I make it that way that is).
 
I guess I need to mention that the button us a codebutton.
 

You keep saying that you can check whether the user actually used a button or not... But what we're saying is if the value can be faked, so can anything client-side, including any test you put in place (presumably a flag of some sort) to see whether they pressed the button or not.

The ONLY way to stop cheating is by doing this server-side.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top