开发者

javascript properties .net properties

Could you please compare the properties

I want t开发者_如何学Co disable a text box 'txtName'. There are two ways

  1. Use javascript, txtName.disabled = true
  2. Use ASP.NET , <.. Enabled="false" ..>

Which method is better and Why?


I assume Enabled="false" results in disabled="disabled" in the generated HTML code. In this case that's clearly the better way as it doesn't require the user to have JavaScript enabled.


If you want to disable a button, the server side method would require a round trip (postback of the page, event handlers run, response returned).

The client side method (javascript) does not require this.

However, if javascript is disables, the client side method will not work.

In either case, the end result is the same (the disabled attribute is set).


There is no difference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜