将java脚本转换为jquery [英] convert to java script to jquery

查看:105
本文介绍了将java脚本转换为jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何简单的转换工具,用于将java脚本转换为jQuery

解决方案

JQuery本身不是一种语言,它是一个javascript库。你没有转换javascript到jquery,因为jquery已经是javascript。


Jquery是一个javascript库,它是一种不引人注目的DOM脚本的简洁方式。所以基本上它是编写javascript代码的更好方法。我认为你在'转换'的意思是 - 你已经有一个Web应用程序,它有很多以旧方式编写的javascript - 现在你想使用jQuery。如果我对你的问题的假设是正确的,那么很遗憾没有工具(至少我知道)会为你做转换。它更多的是学习jQuery的艺术,然后改进和重构你的javascript代码,使用jQuery风格的服务。



如果我可以给出类比来理解它更好的是,你可以用老式的方式编写一个程序,其中只有一个类和数百个变量和函数 - 这对你有用,但在维护方面是一个噩梦,你可以用同样的程序编写相同的程序面向对象的方法论。没有工具可以将旧程序转换为使用OOPS方法 - 它是关于学习OOPS然后重构和改进你的代码。



可能我可以给你一个参考关于如何 编写javascript的一些最佳实践,然后当你了解更多关于jQuery的知识时,你自己会找到使用jQuery库编写javascript的创新和改进方法。



请参阅此链接以获取一些jQuery示例和最佳实践

JQuery示例和最佳实践 [ ^ ]



如果你是全新的对于整个jQuery,请参阅SA的解决方案#3以获取有关它的一些参考。


以防万一,因为没有人给你jQuery的原始引用。这是微不足道的,但是 - 你需要非常清楚地知道:



http:// jquery .com / [ ^ ],

< a href =http://docs.jquery.com/Main_Page> http://docs.jquery.com/Main_Page [ ^ ],

http:/ /en.wikipedia.org/wiki/JQuery [ ^ ],

http://en.wikipedia.org/wiki/JavaScript [< a href =http://en.wikipedia.org/wiki/JavaScripttarget =_ blanktitle =New Window> ^ ],

http://en.wikipedia.org/wiki/ECMAScript [ ^ ]。



-S A

is there any easy converting tools for convert java script to jQuery

解决方案

JQuery is not a language in and of itself, it is a javascript library. You don't "convert" javascript to jquery because jquery is already javascript.


Jquery is a javascript library and it is a neat way of unobtrusive DOM scripting. So essentially it is a better way of writing javascript code. I think what you meant by 'convert' here is that - you already have a web application that has a lot of javascript written in the 'old way' - and now you want to use jQuery. If my assumption is right about your question, unfortunately there are no tools (atleast I am aware of) which will do that 'conversion' for you. It is more about learning the art of jQuery and then improving and refactoring your javascript code to use jQuery style of doing things.

If I can give an analogy to understand it better, you can write a program in the old fashioned way where there is just one class and hundreds of variables and functions in that - which does the job for you but is a nightmare in terms of maintenance, and you can write the same program using Object oriented methodologies. There are no tools to convert the old program to use OOPS methodologies - it is about learning OOPS and then refactoring and improving your code.

Probably I can give you a reference of some best practices of how not to write javascript, and then when you learn more about jQuery, you yourself will find out innovative and improved ways for writing javascript using jQuery library.

Refer this link for some jQuery examples and best practices
JQuery Examples and Best practices[^]

In-case you are totally new to the whole jQuery, please see SA's solution #3 for some references about it.


Just in case, as nobody gave you original references to jQuery. This is trivial, but — something you need to know very well:

http://jquery.com/[^],
http://docs.jquery.com/Main_Page[^],
http://en.wikipedia.org/wiki/JQuery[^],
http://en.wikipedia.org/wiki/JavaScript[^],
http://en.wikipedia.org/wiki/ECMAScript[^].

—SA


这篇关于将java脚本转换为jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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