久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='2rXwI'></bdo><ul id='2rXwI'></ul>

  • <small id='2rXwI'></small><noframes id='2rXwI'>

    <legend id='2rXwI'><style id='2rXwI'><dir id='2rXwI'><q id='2rXwI'></q></dir></style></legend>

      <i id='2rXwI'><tr id='2rXwI'><dt id='2rXwI'><q id='2rXwI'><span id='2rXwI'><b id='2rXwI'><form id='2rXwI'><ins id='2rXwI'></ins><ul id='2rXwI'></ul><sub id='2rXwI'></sub></form><legend id='2rXwI'></legend><bdo id='2rXwI'><pre id='2rXwI'><center id='2rXwI'></center></pre></bdo></b><th id='2rXwI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2rXwI'><tfoot id='2rXwI'></tfoot><dl id='2rXwI'><fieldset id='2rXwI'></fieldset></dl></div>
      1. <tfoot id='2rXwI'></tfoot>

        使用 javascript substring() 創(chuàng)建閱讀更多鏈接

        Using javascript substring() to create a read more link(使用 javascript substring() 創(chuàng)建閱讀更多鏈接)
        <i id='7F92W'><tr id='7F92W'><dt id='7F92W'><q id='7F92W'><span id='7F92W'><b id='7F92W'><form id='7F92W'><ins id='7F92W'></ins><ul id='7F92W'></ul><sub id='7F92W'></sub></form><legend id='7F92W'></legend><bdo id='7F92W'><pre id='7F92W'><center id='7F92W'></center></pre></bdo></b><th id='7F92W'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7F92W'><tfoot id='7F92W'></tfoot><dl id='7F92W'><fieldset id='7F92W'></fieldset></dl></div>

            <tbody id='7F92W'></tbody>
          <legend id='7F92W'><style id='7F92W'><dir id='7F92W'><q id='7F92W'></q></dir></style></legend>
            <bdo id='7F92W'></bdo><ul id='7F92W'></ul>
              <tfoot id='7F92W'></tfoot>

              <small id='7F92W'></small><noframes id='7F92W'>

                • 本文介紹了使用 javascript substring() 創(chuàng)建閱讀更多鏈接的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在開(kāi)發(fā)一個(gè)經(jīng)典 ASP 頁(yè)面,它從數(shù)據(jù)庫(kù)中提取一些內(nèi)容并在前 100 個(gè)字符之后創(chuàng)建一個(gè)閱讀更多鏈接,如下所示;

                  I'm developing a Classic ASP page that pulls some content from a database and creates a Read more link after the first 100 characters as follows;

                  <div class="contentdetail"><%=StripHTML(rspropertyresults.Fields.Item("ContentDetails").Value)%></div>
                  
                  <script type="text/javascript">
                      $(function() {
                  
                          var cutoff = 200;
                          var text = $('div.contentdetail').text();
                          var rest = $('div.contentdetail').text().substring(cutoff);
                          if (text.length > 200) {
                            var period = rest.indexOf('.');
                            var space = rest.indexOf(' ');
                            cutoff += Math.max(Math.min(period, space), 0);
                          }
                  
                          var visibleText = $('div.contentdetail').text().substring(0, cutoff);
                  
                          $('div.contentdetail')
                              .html(visibleText + ('<span>' + rest + '</span>'))
                              .append('<a title="Read More" style="font-weight:bold;display: block; cursor: pointer;">Read More&hellip;</a>')
                              .click(function() {
                                  $(this).find('span').toggle();
                                  $(this).find('a:last').hide();
                              });
                  
                          $('div.contentdetail span').hide();
                      });
                  </script>
                  

                  但是,腳本顯然只是在 100 個(gè)字符后截?cái)嗔宋谋?最好我希望它繼續(xù)寫(xiě)文本,直到第一個(gè)句號(hào)或空格,例如.這可以嗎?

                  However, the script obviously just cuts the text off after 100 characters. Preferably I would like it to keep on writing text until the first period or space, for example. Is this possible to do?

                  謝謝.

                  推薦答案

                  var cutoff = 100;
                  var text = $('div.contentdetail').text();
                  var rest = text.substring(cutoff);
                  if (text.length > cutoff) {
                    var period = rest.indexOf('.');
                    var space = rest.indexOf(' ');
                    cutoff += Math.max(Math.min(period, space), 0);
                  }
                  // Assign the rest again, because we recalculated the cutoff
                  rest = text.substring(cutoff);
                  var visibleText = $('div.contentdetail').text().substring(0, cutoff);
                  

                  稍微縮短了一點(diǎn).編輯:修復(fù)了一個(gè)錯(cuò)誤編輯:生活質(zhì)量改善

                  shortened it a bit. EDIT: Fixed a bug EDIT: QoL improvement

                  這篇關(guān)于使用 javascript substring() 創(chuàng)建閱讀更多鏈接的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 ajax 調(diào)用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無(wú)法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)

                • <small id='x54WU'></small><noframes id='x54WU'>

                  1. <tfoot id='x54WU'></tfoot>

                      <tbody id='x54WU'></tbody>

                          <bdo id='x54WU'></bdo><ul id='x54WU'></ul>
                          <legend id='x54WU'><style id='x54WU'><dir id='x54WU'><q id='x54WU'></q></dir></style></legend>
                            <i id='x54WU'><tr id='x54WU'><dt id='x54WU'><q id='x54WU'><span id='x54WU'><b id='x54WU'><form id='x54WU'><ins id='x54WU'></ins><ul id='x54WU'></ul><sub id='x54WU'></sub></form><legend id='x54WU'></legend><bdo id='x54WU'><pre id='x54WU'><center id='x54WU'></center></pre></bdo></b><th id='x54WU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='x54WU'><tfoot id='x54WU'></tfoot><dl id='x54WU'><fieldset id='x54WU'></fieldset></dl></div>
                            主站蜘蛛池模板: 91五月婷蜜桃综合 | 91在线精品秘密一区二区 | 亚洲精品一区二区 | 色婷婷综合网站 | www久久久 | 日日夜夜天天 | 欧美一区不卡 | 久久久夜色精品亚洲 | 美日韩一区二区 | 国产aa | 国产电影一区二区 | 欧美视频一区二区三区 | 狠狠做六月爱婷婷综合aⅴ 国产精品视频网 | 黄色毛片免费视频 | 久久久久久国产一区二区三区 | 日韩中文字幕在线 | 国产成人精品久久二区二区 | 亚洲一区二区久久久 | 一级美国黄色片 | 国产精品一区二区日韩 | 网黄在线 | 亚洲乱码国产乱码精品精的特点 | 亚洲精品一区二区 | 免费观看成人av | 黑人中文字幕一区二区三区 | 二区av| 亚洲精品一区二三区不卡 | 国产精品久久久久久婷婷天堂 | 亚洲免费人成在线视频观看 | 99reav | 日韩在线观看 | 国产亚洲欧美另类一区二区三区 | 日本特黄a级高清免费大片 成年人黄色小视频 | 国产美女黄色片 | 国产乱码精品1区2区3区 | 亚洲三级在线观看 | 国产在线观看一区二区 | 91免费在线 | 久久综合激情 | 欧美精品成人一区二区三区四区 | 91精品国产91久久久久游泳池 |