SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD

Display Random Pictures Texts and videos with javascript

Are you looking for a script that shows random texts, pictures and videos from YouTube and Facebook? Well, you've come to the right place then. Here I'll show you small javascript which can do all those stuffs.

Random picture examples

At the above example you can see every time you refresh this page it shows a different picture and the script looks like this.

<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji2BXFIr2GWzW37_8h0sUwnDf-Qtct0jgtA9XSuKjMNWWKakABENOOzmrSsfd1usjNUWu8fAErny6-QURf1oYD-_9tGvOTWplQ4Uq4qOod_PcfGaZFuafHGbqSGVuiHgREOKFoDugW2ZzQ/s320/Xiaomi-Mi-A1.png'>";
r_text[1] = "<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjor4CQVlZgyUPiAZnO-1ZT4_Lp7rFBQrVxd9tparT-VtJdeoUnOL_jQ4JNGzoTJKyPt9tNbirlVKPIwvbPh7QeXg7aKYIRGEOzG9CitiNkb6O9IOG-KGjeKTbgCYexiGZpLOBFy0LduJa1/s320/File_transfer_from_Xiaomi_Mi_A1_004.png'>";
r_text[2] = "<img src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPoRJEZzR9RSg21o-3g1s50FkodX01ErIZct4UFe4rly1iKoVKLg0ZUg_PUeunVtLU4Mod8zPSeGv2TMEOuhikwsmb10ceUGtlAeG-7crDKchyphenhyphenpUKQc6yuQpHnflKARtnj0_DpY5xxwFlA/s320/File_transfer_from_Xiaomi_Mi_A1_003.png'>";
var i = Math.floor(3*Math.random())

document.write(r_text[i]);
//-->
</script>

Remember to edit the places where it's been colored as green. If you add a line, make sure you add a number too and at the end add total sum where the number 3 Math.floor(3*is.

<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "<img src='pic1.png'>";
r_text[1] = "<img src='pic2.png'>";
r_text[2] = "<img src='pic3.png'>";
var i = Math.floor(3*Math.random())

document.write(r_text[i]);
//-->
</script>

Script for showing random texts.
<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "Banana";
r_text[1] = "Mango";
r_text[2] = "Orange";
r_text[3] = "Facebook";
r_text[4] = "YouTube";
r_text[5] = "Whatsapp";
r_text[6] = "Amazing Tips247";
var i = Math.floor(7*Math.random())
document.write(r_text[i]);
//-->
</script>

Script for showing random Facebook videos.
<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "<iframe src='https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FJayShettyIW%2Fvideos%2F447693092698247%2F&show_text=0&width='380' width='380' height='476' style='border:none;overflow:hidden' scrolling='no' frameborder='0' allowTransparency='true' allowFullScreen='true'></iframe>";
r_text[1] = "<iframe src='https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FBenPhillipsUK%2Fvideos%2F452068408702013%2F&show_text=0&width='380' width='380' height='476' style='border:none;overflow:hidden' scrolling='no' frameborder='0' allowTransparency='true' allowFullScreen='true'></iframe>";
r_text[2] = "<iframe src='https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FPrinceEa%2Fvideos%2F435397637256907%2F&show_text=0&width='380' width='380' height='476' style='border:none;overflow:hidden' scrolling='no' frameborder='0' allowTransparency='true' allowFullScreen='true'></iframe>";
var i = Math.floor(3*Math.random())
document.write(r_text[i]);
//-->
</script>

Examples of random Facebook videos


Note:
When you add Facebook or YouTuve embedding codes change " into '. As you can see in the above script.

<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FBenPhillipsUK%2Fvideos%2F452068408702013%2F&show_text=0&width="476" width="476" height="476" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>

Script for showing random YouTube videos.
<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "<iframe width='560' height='315' src='https://www.youtube.com/embed/WTn8XzjGJHk' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>";
r_text[1] = "<iframe width='560' height='315' src='https://www.youtube.com/embed/_JUr4NsPZ_0' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>";
r_text[2] = "<iframe width='560' height='315' src='https://www.youtube.com/embed/1jFMroHSi0Y' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>";
var i = Math.floor(3*Math.random())
document.write(r_text[i]);
//-->
</script> 

Examples of random YouTube videos


No comments:

Post a Comment



Newly posted:
Reason why rich getting richer and poor getting poorer