Forum Moderators: open
I wish to refresh the same page again and again. I mean to say if the user select business categories form category listbox then the later part of the page of the content is refresh and the upper page contain the same as mentioned above except firstlist box heading change to " BUSINESS" .
Is it possible? if yes then how? Can anyone provide the code for the same.
Thanks in advance!
it is possible to do so with javascript, but the script depends on a lot, what you want to do.
first of all, i created a form with 2 listboxes and filled the first one with the categorie items. then wrote the script which fills the list with the appropriate data for each category (from an array defined first) and voila - done:
<html>
<head><title>test</title><script type="text/javascript">
<!--
// define list data
data = new Array();
data[0] = new Array('Dog','Cat','Bird');
data[1] = new Array('Cake','Bread','Croissant');
data[2] = new Array('Perl','PHP','ASP','CFML','VBS');
function list_fill(index) {
// check input
if (index==-1) return;
// listbox reference
listbox = document.test.entries;
// clear the list
m = listbox.options.length;
if (m>1) for (var i=m; i>0; --i) listbox.options[i] = null;
// fill the list
listbox.options.length = data[index].length;
for (var i=0; i < data[index].length; ++i) listbox.options[i].text = data[index][i];
}
//-->
</script>
</head><body>
<form name="test" action="">
<table><tr><td>
<!-- first list -->
<select name="cat" size="4" onclick="list_fill(document.test.cat.selectedIndex);">
<option>Animals</option>
<option>Backwaren</option>
<option>Script Languages</option>
</select>
</td><td> </td><td>
<!-- second list -->
<select name="entries" size="4" >
<option>- select a categorie on the left first -</option>
</select>
</td></tr></table>
<br />
<input type="submit" />
</form>
</body></html>
hope this helps
- hakre
If anyone select categorie item ANIMAL from the list1 box then the later part of the page display something like this..
cat_item Quantity
dog 10
Bird 15
cat 20
And so for the other dropdown list box. Assume that the quantity records came from the table name cat_quant.
Hope,this time the pciture is more clear for you.
Thanks for your anticipations.