Hi
Ive got a piece of js code which currently i am repeating as i dont know javascript and cant make a loop. Please help me arrange this code so it loops. This is the code as is:
HTML Code:
<script>
if(document.images)
{ col = new Array()
for(i=0;i<10;i++)
{ col[i] = new Image()
col[i].src = "http://www.webmaster-talk.com/images/col" + i + ".gif" } }
function glassauto1()
{if(document.images){document.colswitch1.src="http://www.webmaster-talk.com/images/col"+document.doorglass.door1glass.selectedIndex+".gif"}}
window.onerror=null;
function glassauto2()
{if(document.images){document.colswitch2.src="http://www.webmaster-talk.com/images/col"+document.doorglass.door2glass.selectedIndex+".gif"}}
window.onerror=null;
</script>
and this is along the lines of what i want
HTML Code:
<script>
if(document.images)
{ col = new Array()
for(i=0;i<10;i++)
{ col[i] = new Image()
col[i].src = "http://www.webmaster-talk.com/images/col" + i + ".gif" } }
var numdoor = doorform.numdoor.value; // for example 2
for(b=1; b< numdoor ;b++)
{
function glassauto[b]()
{if(document.images){document.colswitch[b].src="http://www.webmaster-talk.com/images/col"+document.doorglass.door[b]glass.selectedIndex+".gif"}}
window.onerror=null;
}
</script>
Id be most greatly if you can help me sort this simple script.
Last edited by hiptobesquare; 02-20-2006 at 12:26 PM..
|