Thread: What is wrong with this code??
Results 1 to 12 of 12
Related
-
What is wrong with this code Forum: CSS Forum
Replies: 4 -
Script, logic or syntax wrong.....or have I got it all wrong Forum: PHP Forum
Replies: 3 -
What is wrong with this code? Forum: HTML Forum
Replies: 1 -
What is wrong with this code?? Forum: HTML Forum
Replies: 0 -
What's wrong with this? Forum: HTML Forum
Replies: 5
-
05-12-2003, 05:53 PM #1
What is wrong with this code??
I have tried and tried to get this to work! I want this image to change everyday, I have 7 preloaded images but it keeps cycling thru them like a regular animation. I have given myself a headache trying to figure this out!! Silly-girl
<html>
<head>
<title>Untitled</title>
<!-- JavaScript Banner Rotator - Rotate banners in order after a set period of time.
<!-- Text automatically created by Banner Maker Pro www.bannermakerpro.com-->
<!-- Put this text in the HEAD section of the HTML -->
<script language="JavaScript">
<!--
var AdNum = 0;
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
links = new initArray(
)
images = new initArray(
)
alttext = new initArray(
)
// -->
</script>
<!-- End Banner Rotator HEAD Code -->
</head>
<body>
<!-- JavaScript Banner Rotator - Rotate banners in order after a set period of time.
<!-- Text automatically created by Banner Maker Pro www.bannermakerpro.com-->
<!-- Put this text in the BODY section of the HTML -->
<script language="JavaScript">
<!--
var bannerlink = ""
function rotatebanners() {
if (AdNum == 1) {
AdNum = 0
}
document.BannerAd.src=images[AdNum]
document.BannerAd.alt=alttext[AdNum]
setTimeout("rotatebanners()",*1000,*60,*60,*24)
bannerlink = links[AdNum]
AdNum++
}
function changelink() {
location = bannerlink
}
// -->
</script>
<a href='javascript:changelink()'><img src="http://groups.msn.com/_Secure/0UgAAAGsYTPZD6z9qUuEN11!o2efpgxVUX4TiM10Jfc6B4yf*MxoqVyXAU6i1OXcxDXf3tjGeK2YIhI1fQBX!8Qs*FE4iRdrag8T7cBTY0Q30B4FnSi5NINPle9Fo8GDM/bhouseani%28c%29.gif?dc=4675421635144269082" name="BannerAd" alt=""width="262" height="333" ></a>
<script language="JavaScript">
rotatebanners();
</script>
<!-- End Banner Rotator BODY Code -->
</body>
</html>
-
05-12-2003, 11:44 PM #2
just replace tip with the image url
for example
msg[2] = "<img src='image.jpg'>"
then put "writeTip()" into wherever it is u want the image to display, for example, in a table. hope that helps
*********begin code*********
var msg = new Array();
Stamp = new Date();
today = Stamp.getDate();
msg[1] = "Tip 1";
msg[2] = "Tip 2";
msg[3] = "Tip 3";
msg[4] = "Tip 4";
msg[5] = "Tip 5";
msg[6] = "Tip 6";
msg[7] = "Tip 7";
msg[8] = "Tip 8";
msg[9] = "Tip 9";
msg[10] = "Tip 10";
msg[11] = "Tip 11";
msg[12] = "Tip 12";
msg[13] = "Tip 13";
msg[14] = "Tip 14";
msg[15] = "Tip 15";
msg[16] = "Tip 16";
msg[17] = "Tip 17";
msg[18] = "Tip 18";
msg[19] = "Tip 19";
msg[20] = "Tip 20";
msg[21] = "Tip 21";
msg[22] = "Tip 22";
msg[23] = "Tip 23";
msg[24] = "Tip 24";
msg[25] = "Tip 25";
msg[26] = "Tip 26";
msg[27] = "Tip 27";
msg[28] = "Tip 28";
msg[29] = "Tip 29";
msg[30] = "Tip 30";
msg[31] = "Tip 31";
function writeTip() {
document.write(msg[today]);
*********end code*********
-
05-13-2003, 09:30 AM #3
Doorknob, although I apperciate the answer... I have not a clue as to what you are talking about? Silly-girl
-
05-13-2003, 11:39 AM #4
this is how its used
hope that helps
***************************************
<html>
<head>
<script language=Javascript>
<!--
var msg = new Array();
Stamp = new Date();
today = Stamp.getDate();
msg[1] = "<img src='imgurl.jpg'>";
msg[2] = "<img src='imgurl.jpg'>";
msg[3] = "<img src='imgurl.jpg'>";
blah blah
msg[28] = "<img src='imgurl.jpg'>";
msg[29] = "<img src='imgurl.jpg'>";
msg[30] = "<img src='imgurl.jpg'>";
msg[31] = "<img src='imgurl.jpg'>";
function writeTip() {
document.write(msg[today]);
-->
</script>
</head>
<body onLoad='writetip()'>
</body>
</html>
***************************************
-
05-14-2003, 07:50 AM #5
Darn! That is not working either, I keep getting script errors, about object expected, and '}' ? Silly- girl
-
05-14-2003, 09:30 AM #6
Can you post the URL of the page where you're testing?
-
05-14-2003, 10:31 AM #7
Use the search and replace function of your editor to count the left { and right } curley brackets to make sure they match.
-
05-14-2003, 03:12 PM #8
http://www.haleyshaven.com/anibird.html
Here is the page, it is blank, but you can look at the source. Silly-girl
-
05-14-2003, 05:54 PM #9
Though I am no JS pro, I do not think this is proper
Code:'}'
Dave
-
05-14-2003, 08:43 PM #10
Dave, thank you, I tried your suggestion but it didnt work, I did however try to modify it and put the brackets around the entire function code, and it cleared up that error, but I am getting another one (grrrrrr), it says that it is
Line 20
Char 4
Error Expected (the character it depicts is a smiley face with
2 lines going up and down for eyes, a nose that is at the bottom of the eyes.. and a diag slash to the left for the mouth)
Hope you can get it from the description. I have worked and cleared up the other errors.
Just want to say, that you all have been a godsend to someone who is just learning... Thank you for your patience!!
Silly-girl
-
05-15-2003, 09:21 AM #11
Try this instead of what's there now:
...
function writeTip() { document.write(msg[today]); }
//-->
</script>
-
06-08-2003, 10:28 PM #12
Well I took a look at this and tried to get it to work, I hope this helps:
<head>
<title>Ani bird</title>
<SCRIPT type=text/javascript>
<!--
var msg = new Array();
Stamp = new Date();
today = Stamp.getDate();
msg[1] = newImage("images/templateover1_10.gif");
msg[2] = newImage("images/templateover1_10.gif");
msg[3] = newImage("images/templateover1_10.gif");
msg[4] = newImage("images/templateover1_10.gif");
msg[5] = newImage("images/templateover1_10.gif");
msg[6] = newImage("images/templateover1_10.gif");
msg[7] = newImage("images/templateover1_10.gif");
function writeTip()
{
document.write(msg[today]);
}
//-->
</SCRIPT>
</head>
<body onLoad=writeTip();>
</body>
</html>
change the image files back, it's giving me an undefined error, which is your msg= Array I don't think it is an array. But I am not good a js so maybe someone else can fix that and it should work.
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum