Sie befinden sich hier im Forenarchiv von phpforum.de wenn Sie direkt ins Forum möchten, klicken Sie bitte hier. Zur Startseite kommen Sie hier.

using arrays

i use an array to save different informations, which is putting in the right place by "document.getElementById('content').innerHTML = test".

but between my information pieces are "," and i don't know why and how to erase them.

anny solution for me, the java script beginner?

thanks a lot.

<html>
<head>

<script type="text/javascript">
<!--

function testfunc(){

var test = Array()
test[0] ="test1"
test[1] ="test2"
test[2] ="test3"

document.getElementById('content').innerHTML = test

}
//-->
</script>
</head>

<body onLoad="testfunc()">

<div id="content">
</div>

</body>
</html>

Hier gehts zum Orginal Eintrag "using arrays" im Forum

Antworten

this is because if you want to show the whole array (test) the values are separated by ",". If you don't want this you should write sth like this:

var x=test[0]+test[1]+test[2]
document.getElementById('content').innerHTML = x

or if you have more than 3 values:

var x=""
for(i=0;i<number of the Array;i++) x+=test[i]
document.getElementById('content').innerHTML = x


Hier gehts zum Orginal Eintrag "using arrays" im Forum
 
phpforum.de | Impressum | Handy Bundles