J
Jari Hujanen
Hi,
I'm a novice at JavaScript so my problems can be simple for the more
experienced scripters but problems really drive me nuts sometimes. Maybe
someone here sees immediately what is wrong in the next script that I made.
Please help me. The problem is that the code can work with two or a few
rows/elements of the array but when there are more rows in the array,
nothing works anymore. The amount of rows accepted by the script varies.
First, the script only accepted two rows. Then, it suddenly accepted six
rows but I need more rows.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>arrayBusiness</title>
</head>
<body>
<script type="text/javascript" language="javascript">
<!--
var arrayBusiness = new Array();
arrayBusiness[0] = '<h4>Business</h4>';
arrayBusiness[1] = '<ul><li><a
href=\"http://www.nordea.fi/\">Nordea</a></li>';
arrayBusiness[2] = '<li><a
href=\"http://www.aarre.fi/aarre/aloitus.jsp\">Aarre.fi</a></li>';
arrayBusiness[3] = '<li><a
href=\"http://www.kuluttajavirasto.fi/\">Kuluttajavirasto</a></li>';
arrayBusiness[4] = '<li><a
href=\"https://www.palkka.fi/\">Palkka.fi</a></li>';
arrayBusiness[5] = '<li><a
href=\"http://www.prh.fi/fi/kaupparekisteri.html\">PRH:n
Kaupparekisteri</a></li>';
arrayBusiness[6] = '<li><a
href=\"http://www.suomi.fi/suomifi/suomi/asiointi_ja_lomakkeet/\">Suomi.fi
– Asiointi ja lomakkeet</a></li></ul>';
for (i=0;i<arrayBusiness.length;i++) {
document.write(arrayBusiness);
}
//-->
</script>
</body>
</html>
I'm a novice at JavaScript so my problems can be simple for the more
experienced scripters but problems really drive me nuts sometimes. Maybe
someone here sees immediately what is wrong in the next script that I made.
Please help me. The problem is that the code can work with two or a few
rows/elements of the array but when there are more rows in the array,
nothing works anymore. The amount of rows accepted by the script varies.
First, the script only accepted two rows. Then, it suddenly accepted six
rows but I need more rows.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>arrayBusiness</title>
</head>
<body>
<script type="text/javascript" language="javascript">
<!--
var arrayBusiness = new Array();
arrayBusiness[0] = '<h4>Business</h4>';
arrayBusiness[1] = '<ul><li><a
href=\"http://www.nordea.fi/\">Nordea</a></li>';
arrayBusiness[2] = '<li><a
href=\"http://www.aarre.fi/aarre/aloitus.jsp\">Aarre.fi</a></li>';
arrayBusiness[3] = '<li><a
href=\"http://www.kuluttajavirasto.fi/\">Kuluttajavirasto</a></li>';
arrayBusiness[4] = '<li><a
href=\"https://www.palkka.fi/\">Palkka.fi</a></li>';
arrayBusiness[5] = '<li><a
href=\"http://www.prh.fi/fi/kaupparekisteri.html\">PRH:n
Kaupparekisteri</a></li>';
arrayBusiness[6] = '<li><a
href=\"http://www.suomi.fi/suomifi/suomi/asiointi_ja_lomakkeet/\">Suomi.fi
– Asiointi ja lomakkeet</a></li></ul>';
for (i=0;i<arrayBusiness.length;i++) {
document.write(arrayBusiness);
}
//-->
</script>
</body>
</html>