S
shotokan99
i made a table dynamically :
..
..
..
</style>
</head>
<body>
<div id="dmain" align="center" class="normaltxt">
<table align="center" border="1">
<script type="text/javascript">
artist=new Array();
artist[0]='James';
artist[1]='Lea';
artist[2]='Rudy';
artist[3]='Wonder 9';
artist[4]='Arthur';
artist[5]='Dave';
artist[6]='Fred';
artist[7]='Howard';
artist[8]='Cindy';
James=new Array();
James[0]='Do you know';
James[1]='Your song';
James[2]='Im coming home';
row=3;
col=3;
a=0;
for(i=1; i<=row; i++){
document.write('<tr>');
for(n=1; n<=col; n++){
document.write('<td width="200" height="30"
onclick="dispsong('+artist[a]+')">'
+artist[a]+'</td>');
a=a+1;
}
document.write('</tr>');
}
</script>
..
..
..
what should happen is whenever the user clicks on the artist it must
display another table containing his/ her songs. what i wanted to
happen is the table be displayed underneath the artist table. but what
is happening now, upon clicking the page refreshes and display on the
song table. what is the work around for this?
<script type="text/javascript">
function dispsong(s){
_col=3;
_row=Math.round(s.length/3);
x=0;
document.write('<table align="center" border="1" >');
for(i=1;i<=_row; i++){
document.write('<tr>');
for(n=1; n<=_col; n++){
document.write('<td width="200" height="30" class="normaltxt">'+s[x]
+'</td>');
x=x+1;
}
document.write('</tr>');
}
document.write('</table>');
}
</script>
..
..
..
</style>
</head>
<body>
<div id="dmain" align="center" class="normaltxt">
<table align="center" border="1">
<script type="text/javascript">
artist=new Array();
artist[0]='James';
artist[1]='Lea';
artist[2]='Rudy';
artist[3]='Wonder 9';
artist[4]='Arthur';
artist[5]='Dave';
artist[6]='Fred';
artist[7]='Howard';
artist[8]='Cindy';
James=new Array();
James[0]='Do you know';
James[1]='Your song';
James[2]='Im coming home';
row=3;
col=3;
a=0;
for(i=1; i<=row; i++){
document.write('<tr>');
for(n=1; n<=col; n++){
document.write('<td width="200" height="30"
onclick="dispsong('+artist[a]+')">'
+artist[a]+'</td>');
a=a+1;
}
document.write('</tr>');
}
</script>
..
..
..
what should happen is whenever the user clicks on the artist it must
display another table containing his/ her songs. what i wanted to
happen is the table be displayed underneath the artist table. but what
is happening now, upon clicking the page refreshes and display on the
song table. what is the work around for this?
<script type="text/javascript">
function dispsong(s){
_col=3;
_row=Math.round(s.length/3);
x=0;
document.write('<table align="center" border="1" >');
for(i=1;i<=_row; i++){
document.write('<tr>');
for(n=1; n<=_col; n++){
document.write('<td width="200" height="30" class="normaltxt">'+s[x]
+'</td>');
x=x+1;
}
document.write('</tr>');
}
document.write('</table>');
}
</script>