<script language="JavaScript">
function show_board(board_top,board){
var select_index,select_id,select_name,i,j;
select_index=board_top.selectedIndex;
select_id=board_top.options[select_index].value;
form1.parent_id.value=select_id;
form1.board_top_add.value=board_top_arr[select_id].name;
form1.note_top_add.value=board_top_arr[select_id].note;
form1.manager_top_add.value=board_top_arr[select_id].manager;
for(i=board.length-1;i>=0;i--){
board.remove(i);
}
for(i=0;i<board_arr[select_id].length;i++){
if(typeof(board_arr[select_id][i])=="object"){
var oOption = document.createElement("OPTION");
oOption.text=board_arr[select_id][i].name;
oOption.value=board_arr[select_id][i].id;
//document.all.MyList.add(oOption);
board.add(oOption);
}
}
}
function select_board(board){
var select_index,select_id;
select_index=board.selectedIndex;
select_id=board.options[select_index].value;
form1.board_id.value=select_id;
form1.board_add.value=board_arr[form1.parent_id.value][select_id].name;
form1.note_add.value=board_arr[form1.parent_id.value][select_id].note;
form1.manager_add.value=board_arr[form1.parent_id.value][select_id].manager;
}
function W(text){
document.write(text);
}
function board_func(id,name,note,manager){
this.id=id;
this.name=name;
this.note=note;
this.manager=manager;
}
var board_arr=new Array();
var board_top_arr=new Array();
<?php
$board_top_option="";
$query="select board_id,board_name,board_note,board_manager from board where board_level='1' order by board_id";
$result_top=mysql_db_query($dbname,$query);
while($myrow_top=mysql_fetch_array($result_top)){
$board_top_option.="<option value='$myrow_top[board_id]'>$myrow_top[board_name]</option>\n";
echo "board_top_arr[$myrow_top][board_id]]=new board_func('$myrow_top[board_id]','$myrow_top[board_name]','$myrow_top[board_note]','$myrow_top[board_manager]');\n";
$query="select board_id,board_name,board_note,board_manager from board where board_level='2' and parent_id='$myrow_top[board_id]' order by board_id";
$result=mysql_db_query($dbname,$query);
echo "var tmp_arr=new Array();\n";
while($myrow=mysql_fetch_array($result)){
echo "tmp_arr[$myrow][board_id]]=new board_func('$myrow[board_id]','$myrow[board_name]','$myrow[board_note]','$myrow[board_manager]');\n";
}
echo "board_arr[$myrow_top][board_id]]=tmp_arr;\n";
}
?>
function checkform(text){
if(text.value.length==0){
alert("请输入要添加的版面名称!");
return false;
}
return true;
}
</script>