By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,288 Members | 3,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,288 IT Pros & Developers. It's quick & easy.

form name problem

P: n/a
Dear All,

i am using asp.net, i have assign a form name to a form, e.g.

<form name='myForm' runat='server'>
<input type='text' name='field' value=''>
</form>

i have a javascript function, i am going to

<script>
document.myForm.field.value = 0
</script>

while i run i, the form name has been changed.

so, document.myForm.field.value has bug............

How to solve this problem, besides using document.all.field.value

thank you

Regards,
scli
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can use: document.forms[0].field.value = 0

-Jason

Harry wrote:
Dear All,

i am using asp.net, i have assign a form name to a form, e.g.

<form name='myForm' runat='server'>
<input type='text' name='field' value=''>
</form>

i have a javascript function, i am going to

<script>
document.myForm.field.value = 0
</script>

while i run i, the form name has been changed.

so, document.myForm.field.value has bug............

How to solve this problem, besides using document.all.field.value

thank you

Regards,
scli

Nov 18 '05 #2

P: n/a
Studio.NET's Javascript debugger is very good. Place a breakpoint in your
javascript code and you can use that command window or watch variables to
see any form objects you are interested in.

Hope this helps.
"Harry" <ha******@mail.hongkong.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
Dear All,

i am using asp.net, i have assign a form name to a form, e.g.

<form name='myForm' runat='server'>
<input type='text' name='field' value=''>
</form>

i have a javascript function, i am going to

<script>
document.myForm.field.value = 0
</script>

while i run i, the form name has been changed.

so, document.myForm.field.value has bug............

How to solve this problem, besides using document.all.field.value

thank you

Regards,
scli

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.