Results 1 to 1 of 1
Related
-
Random Pictures script doesn't always work. Forum: Javascript Forum
Replies: 1 -
is there a difference between <script language="javascript> and <script type="text/javascript"> Forum: Javascript Forum
Replies: 8 -
random images php script Forum: PHP Forum
Replies: 3 -
need help with this script Forum: Website Scripts Forum
Replies: 1
-
01-27-2007, 02:34 AM #1
Help with Random Content script (need hotlink in script)
Hi folks,
I have a javascript that loads random content into a table column on my site. I found this script some time ago in another forum and don't know who wrote it. For what I'm attemtping to achieve this script is nearly perfect. However, there is no link feature in this script. I've attempted to modify it with disasterous results (I don't know a thing about javascript).
I need to have either the image linked or some other other section so when content loads the visitor can click to get more about that specific item.
Perhaps there could be an additional variable called URL that coincides with the content??
Example:
var url = new Array();
url[0] = 'http://www.thispage.com';
etc...
Your help with this is greatly appreciated.
The complete script is below:
// JavaScript Source Document (the profiles.js script)
var randomNumber = Math.floor(Math.random() * 6);
var images = new Array();
images[0] = 'Image 1.jpg';
images[1] = 'Image 1.jpg';
images[2] = 'Image 1.jpg';
images[3] = 'Image 1.jpg';
images[4] = 'Image 1.jpg';
images[5] = 'Image 1.jpg';
var names = new Array();
names[0] = 'Name 1';
names[1] = 'Name 2';
names[2] = 'Name 3';
names[3] = 'Name 4';
names[4] = 'Name 5';
names[5] = 'Name 6';
var deg = new Array();
deg[0] = 'Sub Heading 1';
deg[1] = 'Sub Heading 2';
deg[2] = 'Sub Heading 3';
deg[3] = 'Sub Heading 4';
deg[4] = 'Sub Heading 5';
deg[5] = 'Sub Heading 6';
var desc = new Array();
desc[0] = 'Text 1';
desc[1] = 'Text 2';
desc[2] = 'Text 3';
desc[3] = 'Text 4';
desc[4] = 'Text 5';
desc[5] = 'Text 6';
// End script source
<head>
<!-- InstanceEndEditable -->
<script type="text/javascript" src="profiles.js"></script>
<script type="text/Javascript">
function togglecomments (postid) {
var whichpost = document.getElementById(postid);
if (whichpost.className=="visible") {
whichpost.className="hidden";
}
else {
whichpost.className="visible";
}
}
</script>
</head>
<body>
<script type="text/javascript">
<!--
document.write('<img src="' + images[randomNumber] + '" alt="' + names[randomNumber] + '" width="130" height="90" /></div>');
document.write('<div class="subFeature-title"><h2>' + names[randomNumber] + '</h2>');
document.write('<p><strong>Degree(s): </strong>' + deg[randomNumber] + '</p>');
document.write('<p>' + desc[randomNumber] + '</p>');
//-->
</script>
</body>
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum