hello Javascripts Guru

I have a form with several fields and I need to customize some fields using javascript for allow me to prefill a value and make the field "readonly".

For example I have a field "city" where I want prefill the value "New York". So for do that I used this code:


HTML Code:
<script type="text/javascript">function on_form_loaded(event) {
if (event=='reserve')
document.getElementById('city').setAttribute("value", "New York");
}</script>
This work without problem...


Now for make the field "readonly" I used this code:


HTML Code:
<script type="text/javascript">function on_form_loaded(event) {
if (event=='reserve')
document.getElementById('city').readOnly=true;
}</script>
This work without problem too...

Now I use both code this don't work and only related "readonly" code is taken in consideration. The code related to prefill the value "New York" do not work anymore. It seem I must combine the code and is probably possible to shorten the code for get the two desired properties, but I don't know how to do this.

I must precise I'm newbie and don't have any coding knowledges except in html and css.

Someone can help please ??

thank in advance