arrays images and backgroundImage

This is a discussion on "arrays images and backgroundImage" within the JavaScript Forum section. This forum, and the thread "arrays images and backgroundImage are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 9th, 2007, 20:39
New Member
Join Date: Sep 2007
Location: yorkshire
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
arrays images and backgroundImage

This routine is supposed to change a background with successive images from an array. It worked when I wrote it inline in an html file it worked but having lifted it out I get the error 'missing ) after formal parameters'. What am I doing wrong?

Code: Select all
var box ={
init: function(){
    box.box = document.getElementById("box");
    var mycars = new Array()
    mycars[0] = 'url(1.png)'
    mycars[1] = 'url(2.png)'
    mycars[2] = 'url(3.png)'
    mycars[3] = 'url(4.png)'
    mycars[4] = 'url(5.png)'
    mycars[5] = 'url(6.png)'
    box.swap();
},

swap: function(box.box,mycars)
    {
    for (i=0;i<mycars.length;i++)
    {
    box.box.style.backgroundImage = mycars[i];
    alert("break");
    }
}
};

Last edited by karinne; Sep 10th, 2007 at 13:14. Reason: Please use [ code ]...[ /code ] tags when displaying code.
Reply With Quote

Reply

Tags
image, backgroundimage

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Problems with arrays Scream JavaScript Forum 2 Jan 10th, 2008 16:15
Looping through arrays assgar Starting Out 1 Apr 22nd, 2007 18:43
sending email arrays with php ppgpilot PHP Forum 2 Jan 25th, 2007 16:49
Unique Array of Arrays ktsirig Other Programming Languages 1 Jan 27th, 2006 16:30
arrays? macupryk ASP.NET Forum 1 Sep 30th, 2003 12:44


All times are GMT. The time now is 19:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43