在visual studio中使用带有asp.net的javascript [英] using javascript with asp.net in visual studio

查看:51
本文介绍了在visual studio中使用带有asp.net的javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在visual studio 2010中使用asp.net代码中的java脚本?请分享一个教程,这是一个基本的东西,但因为我是asp.net的新手,所以plzz分享一个教程



提前感谢...

解决方案

Javascript 客户端浏览器上运行,它是驻留在 HTML 页面中的代码物理上或通过链接的JS文件。



ASP.NET 是允许服务器生成这些html页面的机制,来自代码,(比如C#和其他技术),包括 ASPX 页面。



在Visual Studio中运行项目时,你可以调试JS 代码,但这是VS的一个技巧,因为它模拟客户端以便允许调试。



一些链接到学习ASP.NET:

- W3Schools的精彩 JS教程 [< a href =http://www.w3schools.com/js/target =_ blanktitle =新窗口> ^ ]

- 一个关于在MVC模式下开发ASP.NET应用程序的简单教程 [ ^ ]

- 了解ASP.NET应用程序和页面生命周期 - A初学者教程 [ ^ ]

- 如何快速学习ASP.NET [ ^ ]



祝你好运:)



干杯,

Edo


以下两篇文章将帮助您管理ASP.NET应用程序中的JavaScript:



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



在ASP.NET中管理JavaScript库 [ ^ ]


JavaScript:Javascript是一种客户端脚本语言,可直接在客户端浏览器上执行。使用javascript的主要好处是它减少了服务器端流量。通常,javascript用于验证目的,因为它提供了安全的验证代码。所有现代HTML页面都使用JavaScript来添加功能,验证输入,与Web服务器通信等等。



您可以使用javascript作为两种形式的方法。

1.内联javascript

2.内部javascript



1.内联javascript:javascript是声明身体部分内部没有创建功能。在加载表单时直接调用。



ex:

 <  !DOCTYPE     html  >  
< html >
< head >
< 标题 > 内联Javascript < / title >
< / head >
< body >

< h1 > 我的第一个JavaScript < / h1 >
< p id = 演示 > 这是段落。< / p >

< script >
函数Message()
{
document.write(hello world ..... !!);
}

< / body >
< / html >





2.内部JavaScript:内部javascript总是由函数调用哪个函数在头部内部创建。



ex:

 <  !DOCTYPE     html  >  
< html >
< head >
< 标题 > 内部Javascript < / title >
< script >
function Message()
{
document.wite(hello world。 ... !!!);
}
< / script >
< / head >
< body >

< h1 < span class =code-keyword>> 我的第一个JavaScript < / h1 >
< p id = demo > 这是一个段落。< < span class = code-leadattribute> / p >

< 按钮 type = 按钮 onclick = 消息() > 消息< / button > ;

< / body >
< / html >


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...

解决方案

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


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[^]


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:

<!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:

<!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>


这篇关于在visual studio中使用带有asp.net的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆