cfz_548
(cfz_548)
高级会员

老会员
UID 20905
精华
0
积分 539
帖子 544
金钱 539 喜悦币
威望 0
人脉 0
阅读权限 50
注册 2003-6-19
状态 离线
|
xajax问题!!
<?
error_reporting(E_ALL); require_once("./xajax/xajax.inc.php");
class myXajaxResponse extends xajaxResponse { function addAddOption($sSelectId, $sOptionText, $sOptionValue) { $sScript = "var objOption = new Option('".$sOptionText."','".$sOptionValue."');"; $sScript .= "document.getElementById('".$sSelectId."').options.add(objOption);"; $this->addScript($sScript); } }
$xajax = new xajax(); $xajax->decodeUTF8InputOn(); $xajax->setCharEncoding("gb2312"); $xajax->registerFunction('init_load_data'); $xajax->processRequests();
function init_load_data() { $objResponse = new myXajaxResponse(); $array_data[0]=array("电子产品","无线产品"); $array_data[1]=array("aaaa","bbbb"); for($i=0;$i<count($array_data[0]);$i++) { $objResponse->addAddOption("p_type",$array_data[0][$i],$i); } return $objResponse->getXML();
} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>测试</title> <?php $xajax->printJavascript("./xajax/");?> </head> <body onload="xajax_init_load_data()" id="body"> <div id="main"> <select id="p_type" > </select> </div> </body> </html> 为什么我设置array_data[0]为汉字时,就出现错误!
[ 本帖最后由 cfz_548 于 2006-7-26 03:44 PM 编辑 ]
附件: 您所在的用户组无法下载或查看附件
|
|