警报截断了我的数据,我该如何查看它

Alert truncates my data, how can I view it?

本文关键字:何查看 数据 我的      更新时间:2023-09-26

alert()有最大长度吗?

如果是这样,有没有办法克服它...具有更大最大长度的不同工具?

这是来自警报的大量输出...注释在末尾被截断。 截断的内容在浏览器中呈现,所以我知道它在那里。

|<!--p|2--><!--FRAMEWORK
-->
    <div id="Ba">
      <div id="Ba1">
<!--ACCOUNT
--->
<div id="account">
  <img id="picture" class="b" src="foo/images/generic_small.jpg" alt="">
  </img>
  <div id="wrap_menu_new">
    <p id="top_new">
      Test Account    </p>
    <div id="wrap_drop_down_new">
      <p id="signout_button" class="drop_down_new">Sign Out
      </p>
      <p id="settings_button" class="drop_down_new">Settings
      </p>
    </div>
  </div>
</div>
<!--FRAMEWORK
--->
      </div>
    </div>
    <div id="Bb">
      <div id="Bb1">
<!--BOOKMARKS 
--->
<div id="bookmark_hold">
  <form id="bookmark" method="post" name="bookmark">
    <div id="bookmark_url_wrap">
      <input id="bookmark_input_url" name="url" type="text" maxlength="2048" class="bookmark">
        <p id="bookmark_label_url">Url
        </p>
      </input>
    </div>
    <div id="bookmark_title_wrap">
      <input id="bookmark_input_title" name="title" type="text" maxlength="32" class="bookmark">
        <p id="bookmark_label_title">Title
        </p>
      </input>
    </div>
    <div id="bookmark_tag_wrap">
      <input id="bookmark_input_tag" name="tag" type="text" maxlength="8" class="bookmark">
        <p id="bookmark_label_tag">Tag
        </p>
      </input>
    </div>        
    <input type="hidden" name="domain" value="not_domain">
    </input>
    <input type="hidden" name="favicon" value="not_favicon">
    </input>
    <p id="bookmark_flip_button">Delete
    </p>
    <p id="bookmark_add_button">Add
    </p>
    <div id="bookmark_response" class="response">
    </div>
  </form>
  <div id="tag_bookmark_fill">
    <div id="tag_fill">
    <!--TAG FILL 
    -->
    </div>
    <div id="space">
    </div>
    <div id="bookmark_fill">
    <!--BOOKMARK FILL 
    -->
    </div>
  </div>
</div>
<!--TWEETS 
-->
<div id="tweet_hold">
  <form id="tweet" method="post" name="tweet">
    <div id="tweet_input_wrap">
      <input id="tweet_input" name="tweet" type="text" maxlength="40">
        <p id="tweet_label">Comment
        </p>
      </input>
    </div>
    <p id="tweet_button" href="javascript:void(0)">Share
    </p>
    <div id="tweet_response" class="response">
    </div>
    <div id="tweet_fill">
      <!--TWEET FILL 
      -->
    </div>
  </form>
</div>
<!--SETTINGS
-->
<form id="privacy">
  <input type="radio" id="radio1" name="rdo">
  <label for="radio1"></label>  
  <p class="privacy_title">Normal</p>
  <p class="privacy_content">Your bookmarks are posted to the feed.</p>
  <input type="radio" id="radio2" name="rdo">
  <label for="radio2"></label>    
  <p class="privacy_title">Private</p>
  <p class="privacy_content">Your bookmarks are not posted to the feed.</p>
<!--
  <input type="radio" id="radio3" name="rdo">
  <label for="radio3"></label>
  <p class="privacy_title">Secret</p>
  <p class="privacy_content">Same as private and all of your data is encrypted using NSA approved algorithms.</p>
-->
    <p id="save_button" class="wordpress">Save
    </p>
    <p id="cancel_button" class="wordpress">Cancel
    </p>

</form>
<!--FRAMEWORK 
--->
      </div>
    </div>
<!--DYNAMIC CONTENT 
-->
<script type='text/javascript'>new Arc.Shared().set( 'load_on', 1 );</script><div id='bookmark_data'>[{"id":"1","0":"1","title":"ebay ","1":"ebay ","url":"http:'/'/ebay.com","2":"http:'/'/ebay.com","domain":"ebay.com","3":"ebay.com","tag":"buy","4":"buy","favicon":"http:'/'/www.ebay.com'/favicon.ico","5":"http:'/'/www.ebay.com'/favicon.ico"},{"id":"1","0":"1","title":"gilt","1":"gilt","url":"http:'/'/www.gilt.com'/","2":"http:'/'/www.gilt.com'/","domain":"gilt.com","3":"gilt.com","tag":"buy","4":"buy","favicon":"http:'/'/assets2.giltcdn.com'/assets'/201205231954-27b1d5fa2c'/images'/default'/util'/favicon.ico","5":"http:'/'/assets2.giltcdn.com'/assets'/201205231954-27b1d5fa2c'/images'/default'/util'/favicon.ico"},....

是的,浏览器确实限制了alert消息的最大长度。

你为什么要alert()这么大的文本?对于调试,您应该使用适用于所有现代浏览器的console.log()或创建一个div/textarea 并在其中显示数据。