In: Computer Science
HAVE a script to display random images every time you click the browser's refresh button.
(Just need a script code(s) to add to the default code that will display random images every time you click the browser's refresh button.
DEFAULT CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Student's Information</title>
</head>
<body>
<table align ="center" width ="70%">
<tr>
<td colspan ="2">
<h1> </h2>
<h1>Student's Information</h1>
<p><input type="button" id="students" value="Enter Data" /></p>
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<!-- Place this img tag where you wants -->
<img id="image" style=" width: 300px;height: 300px;" />
<table align ="center" width ="70%">
<tr>
<td colspan ="2">
<h1> </h2>
<h1>Student's Information</h1>
<p><input type="button" id="students" value="Enter Data" /></p>
</td>
</tr>
</table>
<script>
// here you can add images. Just follow same order
var img = [
"img1.png",
"img2.png",
"img3.png",
];
// random image
var random = (Math.floor(Math.random() * img.length))
var image = document.getElementById("image")
image.src = img[random ]
</script>
</body>
</html>