Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can use java script inside asp.net code in visual studio 2010?? please share a tutorial it is a basic thing but as i am new in asp.net so plzz share a tutorial

thanks in advance...
Posted

Javascript runs on the client side browser, it is code that reside in the HTML page, either physically or via linked JS files that.

ASP.NET is the mechanism that allows the server to produce those html pages, from code, (like C# and other technologies), including ASPX pages.

when you run a project in Visual Studio, you can debug JS code, but this is a trick by the VS, since it emulates the client side in order to allow that debugging.

Some links to learn ASP.NET:
- W3Schools' great JS tutorial[^]
- A Simple Tutorial on Developing ASP.NET Applications in MVC Pattern[^]
- Understanding ASP.NET Application and Page Life Cycle - A Beginner's Tutorial[^]
- How to learn ASP.NET quickly[^]

Good luck :)

Cheers,
Edo
 
Share this answer
 
v5
Below two articles will help you in managing the JavaScript in your ASP.NET application:

http://msdn.microsoft.com/en-us/library/aa479011.aspx[^]

Managing Your JavaScript Library in ASP.NET[^]
 
Share this answer
 
JavaScript: Javascript is a client side scripting language which is directly execute on client browser. The main benefit of using javascript is that it's reduce the server side traffic. Normally javascript is used for validation purpose because it's provide a secure validation code. All modern HTML pages are using JavaScript to add functionality, validate input, communicate with web servers, and much more.

You can working with javascript as a two form of method.
1. Inline javascript
2. Internal javascript

1. Inline javascript: The javascript is declare inside of body part without creating a function. Which is call directly when form is loaded.

ex:
XML
<!DOCTYPE html>
<html>
<head>
        <title>Inline Javascript</title>
</head>
<body>

<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>

<script>
function Message()
{
        document.write("hello world.....!!");
}

</body>
</html>


2. Internal JavaScript: Internal javascript is always called by function which function is created inside of head part.

ex:
XML
<!DOCTYPE html>
<html>
<head>
        <title>Internal Javascript</title>
<script>
function Message()
{
     document.wite("hello world....!!!");
}
</script>
</head>
<body>

<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>

<button type="button" onclick="Message()">Message</button>

</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900