By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

arrays and functions

P: n/a
looking for a way to pass an array to a function.
====================================
<script>
function myfunction(arrayname)
{
document.write("blablabla"+ arrayname[1] +"blablabla");
}
</script>

<html stuff>

<script>
arrayname = new Array("what", "is", "wrong");
myfunction(arrayname);
</script>
====================================
why wont this work

john
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Lee
john said:

looking for a way to pass an array to a function.
====================================
<script>
function myfunction(arrayname)
{
document.write("blablabla"+ arrayname[1] +"blablabla");
}
</script>

<html stuff>

<script>
arrayname = new Array("what", "is", "wrong");
myfunction(arrayname);
</script>
====================================
why wont this work


The code you posted works just fine.
Why not try posting the actual code that fails?
<html>
<body>
<script>
function myfunction(arrayname)
{
document.write("blablabla"+ arrayname[1] +"blablabla");
}
</script>

<p>HTML Stuff</p>

<script>
arrayname = new Array("what", "is", "wrong");
myfunction(arrayname);
</script>
</body>
</html>

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.