0

たとえば、次のようなものがあります。

    <iframe width="700px" src="/top_list.html"></iframe>

このフレームから table .. 以外のすべてを削除するにはどうすればよいですか? または、ユーザーがそのページからテーブルのコンテンツのみを表示するにはどうすればよいですか?


float 値 ios の切り上げ

たとえばint value1 = 11、2 ( ) で割ってvalue1 / 25 を返した後の値があります。 float の実際の値は 5.5 です。一般に、値を次に高い値に丸めたい..

4

2 に答える 2

0

一意の識別子がなく、top_listページを変更できない場合は、jquery .hide()を使用して、表示したくないものをすべて非表示にすることができます。

于 2013-01-31T18:18:29.137 に答える
0

いくつかのjqueryツールが必要です。

  • http://api.jquery.com/contents/contentsを使用してiframeコンテンツを取得します
  • http://api.jquery.com/next/ nextで、次の要素を取得します.main
  • 残りの要素をターゲットにして非表示にします。確かな例がなければ、私はそれがどのように行われるかを示すために最善を尽くします

私の例は、クエリについて非常に明確です。連鎖がないので、何が起こっているかを見ることができます。お役に立てば幸いです。

$(window).on('load', function() // wait for load event, so the iframe is fully loaded in
{
  var $iframe = $('iframe'); // assuming only one?  You need to target the right iframe, perahps with iframe[src="/top_list.html"] if that's your only option

  var $contents = $iframe.contents();
  var $main = $contents.find('.main');
  var $tbl = $main.next(); // now we have the table

  $contents.find('*').hide(); // hide everything
  $tbl.show(); // show table and...

  var $parent = $tbl.parent(); // get/show all parents of the tbl

  while($parent.length)
  {
     $parent.show(); // show parent
     $parent = $parent.parent(); // move up the hierarchy
  }
});
于 2013-01-31T18:19:12.423 に答える