Ok my friends, Now I will give a tutorial how can we show
random or random video
on your blog or website. For example, my friends
just look at this
blog, under the header there is a video that I
show from youtube.com
random. It is very easy guys, we only use
javascript to do that, the script used the
array in javascript.
Here is the code or
steps comrades.
The steps are:
The steps are:
1. Add a widget in our blogger or friends just added templates, exactly between <body> and </ body>
2. Paste the following script colleagues (this script is placed when adding 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 fellows shall include <b:videos id=’videoku’></b:videos>
3. Or if you want to put on the tag <body>, the fellows shall 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 (")
Post a Comment