Ok my friends, Now I will give a tutorial how can we showrandom or random videoon your blog or website. For example, my friendsjust look at this blog, under the header there is a video that Ishow from youtube.comrandom. It is very easy guys, we only usejavascript to do that, the script used thearray in javascript. Here is the code orsteps comrades.
The steps are:
The steps are:
1. Add a widgetin our blogger or friends just added templates, exactly between <body> and </ body>
2. Paste the followingscript colleagues (this script is placed whenadding a widget, not between tags <body>),
<script language='JavaScript'>
videos = new Array(8);
videos[0] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/MiyFkIGSvhA' width='520'/>";
videos[1] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/3wHUyvi0rw0' width='520'/>";
videos[2] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/jjpOcYZTpQ8' width='520'/>";
videos[3] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/fAa1HZ8dEns' width='520'/>";
videos[4] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/2kgjkoYFgNw' width='520'/>";
videos[5] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/_IrLxrQNf64' width='520'/>";
videos[6] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/z4eredw8_R0' width='520'/>";
videos[7] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/ys0UB_YBb_k' width='520'/>";
index = Math.floor(Math.random() * videos.length);
document.write(videos[index]);
</script>
3. Or if you want to put on the tag <body>, the fellowsshall include <b:videos id=’videoku’></b:videos>
3. Or if you want to put on the tag <body>, the fellowsshall include <b:videos id=’videoku’></b:videos>
So the script becomes
<b:videos id=’videoku’>
<script language='JavaScript'>
videos = new Array(8);
videos[0] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/MiyFkIGSvhA' width='520'/>";
videos[1] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/3wHUyvi0rw0' width='520'/>";
videos[2] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/jjpOcYZTpQ8' width='520'/>";
videos[3] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/fAa1HZ8dEns' width='520'/>";
videos[4] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/2kgjkoYFgNw' width='520'/>";
videos[5] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/_IrLxrQNf64' width='520'/>";
videos[6] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/z4eredw8_R0' width='520'/>";
videos[7] = "<iframe allowfullscreen='allowfullscreen' frameborder='0' height='300' src='http://www.youtube.com/embed/ys0UB_YBb_k' width='520'/>";
index = Math.floor(Math.random() * videos.length);
document.write(videos[index]);
</script>
</b:videos>
*Note :
The sign" friends can replace with two quotes (")
The sign" friends can replace with two quotes (")
0 comments:
Post a Comment