开发者

How to write javascript on asp.net page

开发者 https://www.devze.com 2023-02-17 22:00 出处:网络
How to write javascript codeon asp.net page such as (input box) to get value in a better manner.... or another controls message boxes (alert,confirm,......

How to write javascript code on asp.net page such as (input box) to get value in a better manner .... or another controls message boxes (alert,confirm,...... (please if you c开发者_如何学Can, give me an example? )


as you would on a "normal" html page :)

you can enhance your scripts - no, sometimes you MUST - with eg.

<%= this.inputBox.ClientID %>

i would recommend jQuery for such enhancements ... its feature rich, easy to learn, ...

you could do eg.

var $inputBox = $('#<%= this.inputBox.ClientID %>');
$inputBox.hide();
var oldValue = $inputBox.val();
$inputBox.val('now it has no value');

.. and many more!

there are many tutorials on the net... to give a very rough overview, try this


You can use the ClientID property. Example

<img src="images\cal.gif" 
onclick="openCalendar(<% = txtDate.ClientID %>, 150, -150);return false;" />

Soure

0

精彩评论

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