...

View Full Version : Passing array as argument to function



amars1983
03-12-2009, 05:58 AM
Hi everybody. First post. I'm trying to pass an array as an argument for a function on load of an html page, but can't seem to get it to work. Here is my code. Any help would be greatly appreciated.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>List Multiply</title>
<script type="text/javascript">
function rotateRight(list){
for (var i = 0; i < list.length - 1; i++) {
list[i + 1] = list[i];
count++;
}
var swap;
var start = 0;
list[swap] = list[count];
list[count] = list[start];
list[start] = list[swap];
for (var p = 0; p < list.legth; p++){
document.writeln("list[p]'<br />'");
}
}



</script>
</head>

<body onload="rotateRight(var list[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])">
</body>

oesxyl
03-12-2009, 06:12 AM
<body onload="rotateRight(var list[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])">

remove var list, yellow part, from onload.

best regards

amars1983
03-12-2009, 07:18 AM
<body onload="rotateRight(var list[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])">

remove var list, yellow part, from onload.

best regards

Thank you for the help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum