Questo il codice chiamante:
codice:
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript">
var ajax2 = new Array();
function getfieldslist(sel)
{
var campo = sel.options[sel.selectedIndex].value;
document.getElementById('fields').options.length = 0; // Empty city select box
if(campo.length>0){
var index = ajax2.length;
ajax2[index] = new sack();
ajax2[index].requestFile = 'getfield.php?field='+campo; // Specifying which file to get
ajax2[index].onCompletion = function(){ createfields(index) }; // Specify function that will be executed after file has been found
ajax2[index].runAJAX(); // Execute AJAX function
}
}
function createfields(index)
{
var obj = document.getElementById('fields');
eval(ajax2[index].response); // Executing the response from Ajax as Javascript code
}
</script>
<select id="dhtmlgoodies_country" name="dhtmlgoodies_country" onchange="getfieldslist(this)">
<option value="">Select a table</option>
<option value="an_le">an_le</option>
<option value="data_mov_row_pn">data_mov_row_pn</option>
<option value="an_shares">an_shares</option>
</select>
<div id="fields"></div>
mentre il getfiled.php :
codice:
if(isset($_GET['field'])){
$qy = "select column_name from cf_sys_table_row
where table_name = '$_GET[field]'";
$result =execute_qy_err_detail_result($qy, $MyConn);
$i = 0;
while($Values = mysql_fetch_array($result))
{
?>
var obj = getObjectRefByID(portfolio_box);
var cbx = document.createElement("input");
cbx.type = "checkbox";
cbx.id = "myCBX";
obj.appendChild(cbx);
cbx.setAttribute("checked","checked");
<?php
}
exit;
}