ctoz Posted August 20, 2007 Share Posted August 20, 2007 Back again:Sorry, but function below isn't working. I've double-checked the array items; script is in the head of the html file; have tried several combinations of backslash with single and double quotes; tried [current] inside boxDC()... stumped but hopeful.<script language="JavaScript" type="text/javascript">function boxDC (display,color,current) {oneWhite = new Array("h01","h03","h05","h09");box = document.getElementById(oneWhite[current]);box.style.display = display;box.style.color = color;if (current != oneWhite.length - 1) {current++;setTimeout("boxDC('" + display + "','" + color + "'," + [current] + ")",60);}}</script>called with<a href="#" onclick="boxDC("block","white",0); return false">test</a> Link to comment Share on other sites More sharing options...
Synook Posted August 20, 2007 Share Posted August 20, 2007 The problem is not in the function, which works, however the way you are calling it will not work as you have quotation marks in your onclick value (onclick="boxDC("block","white",0); return false") which causes the browser to try to run onclick="boxDC(". Replace it with <a href="#" onclick="boxDC('block','white',0); return false">test</a> Oh, and remove the square brackets ( [ ) around "current". They will cause the function to fail. Link to comment Share on other sites More sharing options...
ctoz Posted August 20, 2007 Author Share Posted August 20, 2007 s'OK now. Can't be too careful with a newbie! Cheers. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.