<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識(shí)百科 - 正文

        ASP.NET開發(fā)者使用jQuery應(yīng)該了解的幾件事情

        來源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 22:44:07
        文檔

        ASP.NET開發(fā)者使用jQuery應(yīng)該了解的幾件事情

        ASP.NET開發(fā)者使用jQuery應(yīng)該了解的幾件事情:下面這幾點(diǎn)希望能夠幫你加快你的學(xué)習(xí)。 1.把selectors當(dāng)作asp.net中的sets。 在asp.net的世界,通過一個(gè)查詢找到一系列控件是非常少見的.相反我們比較習(xí)慣于通過一個(gè)唯一的ID來找到一個(gè)控件。當(dāng)然,在jQuery中這個(gè)也是沒有問題的,但是jQuery的選擇功能
        推薦度:
        導(dǎo)讀ASP.NET開發(fā)者使用jQuery應(yīng)該了解的幾件事情:下面這幾點(diǎn)希望能夠幫你加快你的學(xué)習(xí)。 1.把selectors當(dāng)作asp.net中的sets。 在asp.net的世界,通過一個(gè)查詢找到一系列控件是非常少見的.相反我們比較習(xí)慣于通過一個(gè)唯一的ID來找到一個(gè)控件。當(dāng)然,在jQuery中這個(gè)也是沒有問題的,但是jQuery的選擇功能

        下面這幾點(diǎn)希望能夠幫你加快你的學(xué)習(xí)。

        1.把selectors當(dāng)作asp.net中的sets。

           在asp.net的世界,通過一個(gè)查詢找到一系列控件是非常少見的.相反我們比較習(xí)慣于通過一個(gè)唯一的ID來找到一個(gè)控件。當(dāng)然,在jQuery中這個(gè)也是沒有問題的,但是jQuery的選擇功能相對更加神奇。

           使用jQuery的selectors能夠很容易定位到一個(gè)set的元素,相對來說比在asp.net中使用迭代的規(guī)則來找到一個(gè)set的元素更加清晰和易于表達(dá)。

        2.使用CSS類來代替styling。

           另外一個(gè)不直觀的技術(shù)是把CSS類作為一個(gè)flag。與'selector engin'一樣,'flag'類也是個(gè)令人驚喜的東西。

           舉個(gè)例子來說吧,最近有個(gè)活動(dòng)是做一個(gè)在線的能夠與客戶端互動(dòng)的紙牌游戲。一個(gè)需求是紙牌需要有個(gè)onclick haddler在某個(gè)特定時(shí)間,不過這些事件只針對那些face down(臉朝下)的。作為一個(gè).net的開發(fā)者我立刻能夠想到的辦法是讓這些紙牌在客戶端通過一個(gè)collection來編號(hào).然后我可以在需要的時(shí)候給這個(gè)數(shù)據(jù)一個(gè)onclick handlers。這個(gè)固然可以,不過難以維護(hù)且有點(diǎn)凌亂。

          現(xiàn)在如果我使用CSS類來實(shí)現(xiàn),face up的紙牌我通過addclass方法為它們加上一個(gè)'flipped'類,然后可以通過一個(gè)簡單的 '$(".card:not(.flipped)")'選擇那些face down的紙牌。使用jQuery的click(fn)功能能夠讓我使用幾行代碼就實(shí)現(xiàn)這個(gè)功能。更重要的是它更容易理解和讀取。

        下面附上幾點(diǎn)英文原版的:

        3。Understand unobtrusive JavaScript. 
         In the ASP.NET world, we use a lot of what's sometimes termed obtrusive JavaScript.  This means that client-side event handlers are defined as attributes on elements.  For example, several ASP.NET WebControls render an OnClick=”javascript:__doPostBack()”attribute as part of their markup.  This is considered obtrusive JavaScript.

        When ASP.NET was initially being developed, this inline JavaScript was the norm.  However, as browsers began providing more sophisticated faculties for imperatively adding event handlers, this declarative technique quickly lost favor with client-side developers. As a consequence, the preferred approach has shifted toward what's called unobtrusive JavaScript.

        Unobtrusive JavaScript is now considered a best practice when wiring up client-side event handlers.  This is primarily because it facilitates separation of concerns between behavioral JavaScript and structural HTML markup.  Unobtrusive JavaScript also helps you to write cleaner, more semantic markup, which improves accessibility and often has SEO benefits.

      1. Use the console to learn interactively.
        Coming from the save-compile-reload paradigm of statically typed server-side development, it's natural to approach client-side development in a similar fashion.  While you certainly can write client-side code that way, it's akin to working blindfolded when you consider the alternatives.

        Since JavaScript is usually interpreted by a browser, the browser is one of the best debugging environments available.  In particular, a JavaScript “console” is terrific for interactively interrogating the DOM, testing jQuery selectors against actual markup, and refining JavaScript code in real-time.

        My preferred browser-based tool is the Firebug addon to Firefox.  I cannot praise this Firebug highly enough.  It has revolutionized how I approach client-side development, both of JavaScript and of CSS.  If you prefer Internet Explorer, IE8's updated developer tools are also very capable in this department.
        Whatever your browser of choice, I urge you to give these utilities a try when debugging client-side functionality.  Once you become proficient with one of these tools, you'll be amazed that you ever developed client-side code without it.

      2. Get the VSDOC.
        Even though browser-based tools are great for debugging, an ASP.NET developer's primary editor is still going to be Visual Studio.  When writing jQuery code in Visual Studio, having proper Intellisense can make a tremendous difference in productivity.  The discoverability that Intellisense provides is especially beneficial when you're unfamiliar with jQuery's API.

        As part of the official support for jQuery, Microsoft provides a documentation file to provide jQuery Intellisense inside Visual Studio 2008.  This is provided through what's called a vsdoc file, and is available on the jQuery download page (via the “Documentation: Visual Studio” links).
        Jeff King has assembled an excellent FAQ to help you get Visual Studio 2008's JavaScript Intellisense working:  http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx

      3. 聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        ASP.NET開發(fā)者使用jQuery應(yīng)該了解的幾件事情

        ASP.NET開發(fā)者使用jQuery應(yīng)該了解的幾件事情:下面這幾點(diǎn)希望能夠幫你加快你的學(xué)習(xí)。 1.把selectors當(dāng)作asp.net中的sets。 在asp.net的世界,通過一個(gè)查詢找到一系列控件是非常少見的.相反我們比較習(xí)慣于通過一個(gè)唯一的ID來找到一個(gè)控件。當(dāng)然,在jQuery中這個(gè)也是沒有問題的,但是jQuery的選擇功能
        推薦度:
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 久久亚洲国产成人精品无码区| 最近免费中文字幕大全视频| 亚洲成AV人在线观看网址| 亚洲一本到无码av中文字幕| 成人爽A毛片免费看| 亚洲人成电影网站久久| 国产成+人+综合+亚洲专| 久草免费福利在线| 亚洲中文字幕第一页在线 | 亚洲色四在线视频观看| 毛片在线全部免费观看| 免费萌白酱国产一区二区| 亚洲AV无码一区二区大桥未久| 无码AV片在线观看免费| 久久精品国产亚洲av麻豆小说| 午夜不卡AV免费| 亚洲午夜久久久久久久久久| 色视频在线观看免费| 亚洲一区二区三区在线视频| 免费人成在线观看视频高潮| 久久青青草原亚洲av无码app| 在线永久看片免费的视频| 亚洲成AV人片高潮喷水| 免费精品国偷自产在线在线| 亚洲欧洲免费无码| 国产亚洲大尺度无码无码专线| 免费成人在线视频观看| 亚洲日本乱码卡2卡3卡新区| yy6080久久亚洲精品| 永久免费av无码入口国语片| 涩涩色中文综合亚洲| 国产精品亚洲产品一区二区三区| 一级特黄aa毛片免费观看| 香蕉大伊亚洲人在线观看| 亚洲国产一区视频| 午夜视频在线免费观看| 久久亚洲中文无码咪咪爱| 亚洲成av人片天堂网| 午夜毛片不卡高清免费| 两个人看的www免费高清 | 亚洲另类无码专区丝袜|