qablan89
qablan89

Reputation: 223

How to write javascript on asp.net page

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 can, give me an example? )

Upvotes: 0

Views: 778

Answers (2)

user57508
user57508

Reputation:

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

Upvotes: 1

Shoban
Shoban

Reputation: 23016

You can use the ClientID property. Example

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

Soure

Upvotes: 0

Related Questions