亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch07_04.htm

?? 用perl編寫CGI的好書。本書從解釋CGI和底層HTTP協議如何工作開始
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<?label 7.4. Bookmarklets?><html><head><title>Bookmarklets (CGI Programming with Perl)</title><link href="../style/style1.css" type="text/css" rel="stylesheet" /><meta name="DC.Creator" content="Scott Guelich, Gunther Birznieks and Shishir Gundavaram" /><meta scheme="MIME" content="text/xml" name="DC.Format" /><meta content="en-US" name="DC.Language" /><meta content="O'Reilly & Associates, Inc." name="DC.Publisher" /><meta scheme="ISBN" name="DC.Source" content="1565924193L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="CGI Programming with Perl" /><meta content="Text.Monograph" name="DC.Type" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" alt="Book Home" usemap="#banner-map" border="0" /><map name="banner-map"><area alt="CGI Programming with Perl" href="index.htm" coords="0,0,466,65" shape="rect" /><area alt="Search this book" href="jobjects/fsearch.htm" coords="467,0,514,18" shape="rect" /></map><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch07_03.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm">CGI Programming with Perl</a></td><td width="172" valign="top" align="right"><a href="ch08_01.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><hr align="left" width="515" /><h2 class="sect1">7.4. Bookmarklets</h2><p>We'll end this chapter with a much less common use of<a name="INDEX-1633" /><a name="INDEX-1634" />JavaScript:<em class="emphasis">bookmarklets</em>. Bookmarklets are JavaScript<a name="INDEX-1635" />URLs that have been saved asbookmarks. The basic concept behind bookmarklets has been aroundsince JavaScript was first created, but it has been slowly growing inpopularity since Steve Kangas first coined the term<em class="firstterm">bookmarklet</em> and created a web site devoted tothem at <a href="http://www.bookmarklets.com/">http://www.bookmarklets.com/</a>. Many peopleconsider bookmarklets a novelty, but they have a much greaterpotential. Bookmarklets really shine when they are combined withcustom CGI scripts, which is why they are of interest to us.</p><a name="ch07-10-fm2xml" /><div class="sect2"><h3 class="sect2">7.4.1. Bookmarklet Basics</h3><p>First, let's see how bookmarklets work. Bookmarklets are mucheasier to show than to explain, so let's look at theworld's most popular program, "Hello World," as abookmarklet. The source for it is as follows:</p><blockquote><pre class="code">javascript:alert("Hello world!")</pre></blockquote><p>If you were to type this into your browser as a location, it woulddisplay the alert shown in <a href="ch07_04.htm#ch07-68588">Figure 7-4</a>.</p><a name="ch07-68588" /><div class="figure"><img width="368" src="figs/cgi2.0704.gif" height="105" alt="Figure 7-4" /></div><h4 class="objtitle">Figure 7-4. Result from our "Hello World" bookmarklet</h4><p>You can enter this directly into your browser because this simpleprogram is also a valid URL. The <em class="emphasis">javascript</em> scheme tells browsers, whichsupport it, that they should interpret the rest of the URL asJavaScript code in the context of the current web page and return theresult as a new web page. You can also create hyperlinks that havethis format. If you were to embed the following into an HTML webpage, then you could click on the link to get the alert as well:</p><blockquote><pre class="code">&lt;A HREF='javascript:alert("Hello world!")'&gt;Run Script&lt;/A&gt;</pre></blockquote><p>However, neither of these examples are actually bookmarklets untilyou save the URL as a bookmark in your <a name="INDEX-1636" />browser. Doing so isbrowser-specific, of course. Most browsers allow you to click on ahyperlink with your right mouse button and choose an option to savethe link as a bookmark. Once you have done this, you have capturedthe script as a bookmarklet that you can run whenever you want bychoosing it from your list of bookmarks.</p><p>Let's look at a more complicated example. We have referencedRFCs several times thus far. Let's make a bookmarklet thatallows you to look up a particular RFC. In this case,<a name="INDEX-1637" /> <a name="INDEX-1,638" />we'll use <a href="http://www.faqs.org/rfc/">http://www.faqs.org/rfc/</a> as the RFCrepository.</p><p>Here is how we might write the JavaScript for this:</p><blockquote><pre class="code">rfcNum = prompt( "RFC Number: ", "" );if ( rfcNum == parseInt( rfcNum ) )    open( "http://www.faqs.org/rfc/" + rfcNum + ".html" );else if ( rfcNum )    alert( "Invalid number." );</pre></blockquote><p>We ask the user for an RFC number. If the user enters an integer, weopen a new browser window to fetch the corresponding RFC. Note thatwe don't handle the case in which the RFC doesn't exist;the user will simply get a 404 error from the www.faqs.org web server. However, if the userenters a value that isn't a number, we do report that error tothem. If the user enters nothing or clicks Cancel, we do nothing.</p><p>Now let's convert to this to a bookmarklet. First, we must needto make sure we do not return any values from our code. If the codein your bookmarklet returns a value, some browsers (includingNetscape's) will replace the current page with the value. Youwill confuse users if, for example, they get an empty page with a<tt class="literal">[null]</tt> in the top left corner every time they useyour bookmarklet. The easiest way to avoid returning a value is touse the <tt class="function">void</tt> function. It takes any value as anargument and returns nothing. We can wrap the<tt class="function">void</tt> function around the last statement thatreturns a value, or simply append it to the end. We'll do thelatter because in this script there are three different lines thatcould be executed last, depending on the user's entry. So weadd the following line to the end of our script:</p><blockquote><pre class="code">void( 0 );</pre></blockquote><p>Next, we <em class="emphasis">should</em> need to remove or encode anycharacters that are not valid within a URL. This includes whitespaceand the following characters: <tt class="literal">&lt;</tt>,<tt class="literal">&gt;</tt>, <tt class="literal">#</tt>, <tt class="literal">%</tt>,<tt class="literal">"</tt>, <tt class="literal">{</tt>, <tt class="literal">}</tt>,<tt class="literal">|</tt>, <tt class="literal">\</tt>, <tt class="literal">^</tt>,<tt class="literal">[</tt>, <tt class="literal">]</tt>,<tt class="literal">`</tt>.<a href="#FOOTNOTE-11">[11]</a> However,<a name="INDEX-1639" /><a name="INDEX-1640" /><a name="INDEX-1641" />NetscapeCommunicator 4.x will not recognize encoded syntax elements (such asbrackets) within JavaScript URLs. So although it means thatbookmarklets containing these characters are invalid URLs, if youwant your bookmarklets to work with Netscape's browsers, youmust leave these characters unencoded. Other browsers accepts thesecharacters encoded or unencoded. In any event, you should remove anyunnecessary whitespace.</p><blockquote><a name="FOOTNOTE-11" /><p>[11]Control and non-ASCIIcharacters are invalid as well, but these values must be escapedwithin JavaScript anyhow. Also, you may notice that this list isdifferent than the list provided in <a href="ch02_01.htm#ch02-80730">Section 2.1.3, "URL Encoding"</a>.That list is for HTTP URLs, so it includes characters that havespecial significance to HTTP. JavaScript URLs are different than HTTPURLs, so this list includes only characters considered illegal forall URLs.</p></blockquote><p>Finally, we prefix our code with <tt class="literal">javascript:</tt>, andwe get the following:</p><blockquote><pre class="code">javascript:rfcNum=prompt('RFC%20Number:','');if(rfcNum==parseInt(rfcNum))open('http://www.faqs.org/rfc/'+rfcNum+'.html');else if(rfcNum)alert('Invalid%20number.');void(0);</pre></blockquote><p>The line endings are not part of the URL but have been added to allowit to fit on the page.</p><p>There is one more thing that you should keep in mind when workingwith bookmarklets. Bookmarklets execute in the same scope as thefrontmost page displayed in the user's browser. This has anumber of advantages as we will see in the next section, <a href="ch07_04.htm#ch07-53404">Section 7.4.2, "Bookmarklets and CGI"</a>. The disadvantage is that you must becareful that the code you create does not conflict with other codethat is on the current page. You should be especially careful withvariable names and create names that are very unlikely to appear onother web sites.<a name="INDEX-1642" /> <a name="INDEX-1,643" />Variables are case-sensitive inJavaScript; using odd combinations of capitalization in variables isa good idea. In our last example, <tt class="literal">rFcNuM</tt> may havebeen a better (though less readable) choice as a variable name.</p><a name="ch07-42535" /><div class="sect3"><h3 class="sect3">7.4.1.1. Compatibility</h3><p>Because <a name="INDEX-1644" /> <a name="INDEX-1,645" />bookmarklets use JavaScript, theyare not compatible with all web browsers. Some browsers that supportJavaScript, such as<a name="INDEX-1646" />Microsoft Internet Explorer 3.0 donot support bookmarklets. Other browsers impose limitations onbookmarklets. Unless you're distributing your bookmarklets asunsupported novelties, you should do extensive testing. Bookmarkletsuse JavaScript in a less than traditional manner, so test them withas many different versions of as many different browsers on as manydifferent platforms as you can.</p><p>You should also keep your bookmarklets short. Some browsers do notimpose a limit on the length of a URL; others limit URLs to 255characters. This can even vary by platform: for example, Communicator4.x allows only 255 characters on MacOS while it allows much longerURLs on Win32.</p><p>One of the features that some users of bookmarklets promote is thatbookmarklets avoid some of JavaScript's browser incompatibilityissues. Because Netscape and Microsoft have different implementationsof JavaScript, if you want to create a bookmarklet that usesincompatible features of each, you can create two differentbookmarklets instead of one bookmarklet that attempts to support bothbrowsers. Then people can choose the bookmarklet that is appropriateto their browser. The problem with this approach is that Netscape andMicrosoft are not the sole distributors of web browsers. Although

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图一区二区| 亚洲高清免费视频| 精品国产亚洲在线| 精品国产一区二区三区av性色| 欧美巨大另类极品videosbest | 一区二区久久久| 国产亚洲欧美在线| 国产精品私人自拍| 亚洲色图一区二区| 亚洲国产日产av| 日本aⅴ亚洲精品中文乱码| 免费观看30秒视频久久| 韩国av一区二区三区四区| 国产尤物一区二区在线| 国产成人欧美日韩在线电影| 99麻豆久久久国产精品免费| 91福利视频在线| 欧美一区二区三区在线观看| 精品成人在线观看| 国产精品成人免费| 性感美女久久精品| 国产高清精品网站| 欧美丝袜自拍制服另类| 精品国产电影一区二区| 国产精品欧美久久久久一区二区| 亚洲一区二区在线视频| 久久99精品久久久久久久久久久久| 丁香激情综合国产| 欧美日韩二区三区| 精品国产麻豆免费人成网站| 亚洲欧美自拍偷拍| 全国精品久久少妇| 91在线免费看| 2019国产精品| 亚洲午夜免费视频| 国产91精品入口| 6080yy午夜一二三区久久| 国产精品你懂的在线欣赏| 日本aⅴ亚洲精品中文乱码| av资源站一区| 久久久国产精品不卡| 丝袜脚交一区二区| 日本高清成人免费播放| 国产亚洲一区二区在线观看| 亚洲国产精品一区二区www| 国产大陆精品国产| 日韩区在线观看| 亚洲一区二区三区四区五区黄| 国产sm精品调教视频网站| 欧美日韩国产在线观看| 亚洲男人的天堂网| 国产精品一区不卡| 日韩免费在线观看| 舔着乳尖日韩一区| 欧美自拍丝袜亚洲| 亚洲免费av在线| 91影院在线免费观看| 日本一区二区三区dvd视频在线| 秋霞午夜鲁丝一区二区老狼| 91福利在线免费观看| 日韩一区日韩二区| 9人人澡人人爽人人精品| 国产午夜亚洲精品理论片色戒| 麻豆精品在线播放| 欧美成人精品福利| 蜜臀av性久久久久蜜臀aⅴ| 91精品国产麻豆国产自产在线 | 成人综合婷婷国产精品久久蜜臀| 精品少妇一区二区三区日产乱码| 天堂久久一区二区三区| 色婷婷激情综合| 亚洲精品中文在线观看| 91视频精品在这里| 亚洲精品成人天堂一二三| 97久久精品人人做人人爽 | 人人爽香蕉精品| 欧美久久免费观看| 视频一区欧美日韩| 日韩你懂的电影在线观看| 六月婷婷色综合| 精品国产一区二区精华| 国产成人免费av在线| 国产精品免费久久| 91视频xxxx| 亚洲成av人片www| 制服丝袜在线91| 国产乱理伦片在线观看夜一区| 久久一日本道色综合| 白白色 亚洲乱淫| 亚洲女同女同女同女同女同69| 欧美三级午夜理伦三级中视频| 日韩av在线免费观看不卡| 久久久久久亚洲综合| 92国产精品观看| 日本成人在线看| 欧美高清在线视频| 欧美优质美女网站| 国产在线看一区| 亚洲欧美aⅴ...| 欧美一区二区三区四区久久| 国内精品久久久久影院一蜜桃| 国产精品麻豆网站| 6080日韩午夜伦伦午夜伦| 国产精品一区二区久久精品爱涩| 国产精品国产精品国产专区不蜜 | 制服.丝袜.亚洲.另类.中文| 国产激情一区二区三区| 一个色综合av| 精品成人在线观看| 在线观看成人免费视频| 黄色资源网久久资源365| 亚洲欧美一区二区久久| 欧美videos中文字幕| 日本道在线观看一区二区| 久久国产精品免费| 亚洲黄色录像片| 国产日韩欧美精品电影三级在线| 欧美精品1区2区3区| 不卡一区在线观看| 久久精品av麻豆的观看方式| 中文字幕日韩一区二区| 欧美电影免费提供在线观看| 日本久久一区二区| 岛国精品在线播放| 蜜臀精品久久久久久蜜臀 | 日韩欧美综合在线| 91激情五月电影| 国产成人精品亚洲午夜麻豆| 日韩一区精品字幕| 一区二区三区不卡视频在线观看| 久久久久久久av麻豆果冻| 欧美福利视频导航| 欧美三级在线视频| 日本高清免费不卡视频| 不卡视频在线观看| 国产在线精品视频| 激情综合网av| 裸体一区二区三区| 日韩av电影天堂| 日产国产欧美视频一区精品| 亚洲午夜电影在线观看| 一区二区三区四区不卡视频| 国产精品美女久久福利网站| 国产欧美日韩另类一区| 国产亚洲一区字幕| 国产无遮挡一区二区三区毛片日本| 在线91免费看| 欧美一区午夜视频在线观看 | 成人综合婷婷国产精品久久| 国模无码大尺度一区二区三区| 免费观看在线色综合| 免费亚洲电影在线| 精品一区二区三区免费视频| 国产一区二区三区香蕉| 国产不卡视频在线观看| 成人性生交大片免费看视频在线 | 老司机午夜精品| 免费成人美女在线观看.| 看片网站欧美日韩| 美国三级日本三级久久99| 毛片av一区二区三区| 久久精品国产久精国产爱| 久久97超碰色| 成人在线一区二区三区| 色香蕉成人二区免费| 欧美美女喷水视频| 精品国产精品一区二区夜夜嗨| 国产喷白浆一区二区三区| 亚洲天堂精品视频| 日本色综合中文字幕| 国产成人在线观看免费网站| 91视频一区二区| 日韩午夜在线观看| 国产欧美精品日韩区二区麻豆天美| 国产精品福利一区二区三区| 亚洲自拍偷拍网站| 久久99精品一区二区三区三区| 岛国av在线一区| 欧美欧美欧美欧美| 欧美mv日韩mv国产网站app| 中文一区二区完整视频在线观看| 亚洲在线一区二区三区| 麻豆高清免费国产一区| 97aⅴ精品视频一二三区| 欧美一区二区啪啪| 国产精品久久三区| 日韩国产欧美在线播放| 99re视频这里只有精品| 91精品国产欧美一区二区18| 亚洲欧洲另类国产综合| 黑人精品欧美一区二区蜜桃| 色综合久久久网| 26uuu亚洲综合色| 亚洲国产日产av| 播五月开心婷婷综合| 精品国产乱码久久久久久久 | 老司机午夜精品| 91久久精品日日躁夜夜躁欧美| 久久午夜免费电影| 天天综合色天天综合色h|