on 10/26/00 11:25 AM, Reed Powell at [EMAIL PROTECTED] wrote:

> 
> ANY IDEAS?  I'M STUMPED, AND I WANTED TO GET THIS PUPPY OFF MY PLATE THIS
> WEEK AND MOVE ON TO OTHER EXCITING THINGS. CODE IS BELOW...

Readonly is not very well supported across browsers and is not reliable.

Try setting a variable as a readonly flag and using the blur() function to
prevent users changing the field, something like (completely off the top of
my head and untested):

var readstate=0;

function checkfield()
    {
    if(readstate != 0)
        {
        document.formname.fieldname.blur();
        }
    }

function calc()
    {
    //do your calc here
    var readstate=1;  //this turns off the field for writing
    }

<input name="fieldname" onfocus="checkfield();" onchange="calc();">


When the field gets focus it tests to see if the readstate variable is 0. if
it is, you are allowed to enter a value. When the value is changed it
performs the calc or whatever and sets the readstate variable to 1. When you
next go to the field, it will see the value of 1 in readstate and blur() the
field, preventing modification.

See how you go.

-- 

Rob Keniger

big bang solutions

<mailto:[EMAIL PROTECTED]>
<http://www.bigbang.net.au>

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to