解決済

ブログのプラグインにyoutube動画をランダム表示させたい

ブログ初心者なのですが可能でしょうか。1つ表示させる事はできたのですが複数をランダム表示となると全く分かりません。宜しければお願い致します。

2008-02-23 12:53の質問
Youtube  ランダム表示  
YouTube
YouTube のホームページはこちらです
jp.youtube.com/
この質問と回答を読んで役に立った場合は「役に立つ質問」に投票してください。投票が多い質問は、役に立つ質問一覧に掲載され、より多くの人に見てもらうことができます。
Ads By Google

回答(2)

1.

2008-02-23 14:29:00ベスト
http://www.forest.impress.co.jp/article/2007/09/14...
のようなソフトがあるみたいです。

IEのみの動作で良いなら
例えば、こんな感じ
<embed id="ytube" src="http://www.youtube.com/v/gb_N7LZQ710" type="application/x-shockwave-flash" wmode="transparent" width="200" height="165"></embed>
<script type="text/javascript"><!--
(function(){
var list = [
    "http://www.youtube.com/v/gb_N7LZQ710",
    "http://www.youtube.com/v/2rkAsCKbFtA",
    "http://www.youtube.com/v/vdSEFPEIZPU",
    "http://www.youtube.com/v/CJnwZkr7uLU",
    "http://www.youtube.com/v/k4_ZGeyBoow"
];
document.getElementById("ytube").src=list[Math.floor(Math.random()*list.length)];
})();
//-->
</script>
表示サイズは、同じことが前提。
ランダム表示するリストは、list に並びで書く。
自信度 : 自信なし 回答レベル : アドバイス

下の方でやってみたのですが表示されました、IEだけで良いのでとりあえず下の方を使わせて頂きます、ありがとうございました。

2.

2008-02-23 15:03:07
回答1を修正(Firefoxも可)
<script type="text/javascript"><!--
(function(){
var list = [
    "http://www.youtube.com/v/gb_N7LZQ710",
    "http://www.youtube.com/v/2rkAsCKbFtA",
    "http://www.youtube.com/v/vdSEFPEIZPU",
    "http://www.youtube.com/v/CJnwZkr7uLU",
    "http://www.youtube.com/v/k4_ZGeyBoow"
];
var src=list[Math.floor(Math.random()*list.length)];
document.write('<embed src="' + src + '" type="application/x-shockwave-flash" wmode="transparent" width="200" height="165"></embed>')
})();
//-->
</script>
回答レベル : 回答
Ads By Google

コメント(2)

#2.  BLUEPIXY
2008-02-23 14:34:00

回答1のアドレスは、「数学ガール」から。

#3.  BLUEPIXY
2008-02-23 15:22:09

別にいいんだけども
<embed> って、XHTMLで使ってよかったっけ?
と一応言っておきます。

トラックバック

トラックバックURL: