PDA

View Full Version : uneditable text boxes


gildash2
02-23-2004, 07:15 AM
hey again, i was just wondering and im really desperate for some expert advice on how to make it so that you can make the text within a text box that within a form uneditable so for instance how would you make this
<input type="text" name="guest" style="border: solid 2px #ff0000" style="background:#0000" style="color:#ff0000" style="position:absolute; top:89px; left:10px" size="10" value=" Guest ">
uneditable by the visitor to the website.
also how after and if command say this:
if (iName == "Kaade" && AccId == "seaweed")
{
window.iframe.location="http://www.yahoo.com";
window.status=('Hello '+iName+'. Welcome');
would you be able to change the value of the text box
maybe something along the lines of this?: document.formname.textboxname.value="the thing you want to change?"
that didnt work before when i tried it, any suggestions on ho wi can fix it? all and any help will be appreciated

agent002
02-23-2004, 09:07 AM
Originally posted by gildash2
hey again, i was just wondering and im really desperate for some expert advice on how to make it so that you can make the text within a text box that within a form uneditable
Simply add the following attribute to the <input>, <select> or <textarea> tag:
readonly="readonly"

Originally posted by gildash2
also how after and if command say this:
if (iName == "Kaade" && AccId == "seaweed")
{
window.iframe.location="http://www.yahoo.com";
window.status=('Hello '+iName+'. Welcome');
would you be able to change the value of the text box
maybe something along the lines of this?: document.formname.textboxname.value="the thing you want to change?"
that didnt work before when i tried it, any suggestions on ho wi can fix it? all and any help will be appreciated
Try using
document.getElementById('somefield').value = "something";
Then the input field needs to have an ID:
id="somefield"

gildash2
02-23-2004, 09:25 AM
thanx a million but i want the text box to change to the value of the variable of iName, do you think you can tell me how to do so? ive tried
document.getElementById('guest').value = "+iName+";
but that doesnt work
all help and any will be apreciated thank you

agent002
02-23-2004, 09:26 AM
that would be as simple as
document.getElementById('guest').value = iName;
:)