简体   繁体   English

javascript 和 asp.net

[英]javascript and asp.net

I am going to be doing a lot more front end work on one of our asp.net projects and I suspect there will be a lot more JavaScript involved.我将在我们的 asp.net 项目之一上做更多的前端工作,我怀疑会涉及更多的 JavaScript。 I have seen and used a lot of tutorials/info on the fundamentals of the JavaScript language but could someone point me towards some resources on JavaScript specifically for using it with asp.net?我已经看到并使用了很多关于 JavaScript 语言基础知识的教程/信息,但是有人可以向我指出 JavaScript 上的一些资源,专门用于将它与 Z1848E732214CCE460F2B24F0C80F5E 一起使用吗? If specific tutorials/pages don't really exist then maybe some of the methods,tools,libraries etc. you would use and are worth reading about?如果特定的教程/页面不存在,那么您可能会使用一些方法、工具、库等并且值得一读?

Remember, that ASP.NET is (mostly) a server-side technology, and what it produces is simply HTML.请记住,ASP.NET(主要)是一种服务器端技术,它产生的只是 HTML。 So there's nothing really specifc to using javascript with ASP.NET.因此,将 javascript 与 ASP.NET 一起使用并没有什么特别的。

What you should do, is to study and understand the HTML which is produced by the ASP.NET controls.您应该做的是学习和了解由 ASP.NET 控件生成的 HTML。

One important point is that the server-side control IDs do not correspond with the client-side IDs of the HTML element.重要的一点是服务器端控件 ID 与 HTML 元素的客户端 ID 不对应。 Eg you'll have to do things like this:例如,您必须执行以下操作:

//aspx:
<asp:HyperLink id="myLink" ... />

//javascript:
var clientId = '<%= myLink.ClientID %>';
// access the client-side element using plain javascript and jQuery:
var linkJs = document.getElementById(clientId);
var linkJq = $('#' + clientId);

My suggestion would be to learn jquery which will make your life a lot easier.我的建议是学习 jquery,这将使您的生活更轻松。 Another thing to keep in mind is that it doesn't really matter whether you are using asp.net or php or any other framework because javascript and associated libraries like jquery use HTML DOM objects and work on the client side. Another thing to keep in mind is that it doesn't really matter whether you are using asp.net or php or any other framework because javascript and associated libraries like jquery use HTML DOM objects and work on the client side.

A good book to learn jquery is Jquery in Action学习jquery的好书是Jquery在行动

EDITED:编辑:

W3Schools is NOT good for the basics of JavaScript W3Schools 不适合 JavaScript 的基础知识

Once you get to grips with JavaScript you may find JQuery useful.一旦您掌握了 JavaScript,您可能会发现 JQuery 很有用。 Its a very neat and useful JavaScript Library它是一个非常整洁和有用的 JavaScript 库

http://jquery.com/ http://jquery.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM