Ö´ÐÐAJAX·µ»ØHTMLƬ¶ÎÖеÄJavaScript½Å±¾
Èç¹ûAJAX¼ÓÔصÄÊý¾ÝÊÇÒ»¸öHTMLƬ¶Î£¬¶øÇÒÕâ¸öHTMLƬ¶Î»¹°üº¬½Å±¾<script>¿é£¬ÄÇôÔÚÄã°ÑÕâÊý¾ÝxmlHttp.responseTextÓÃinnerHTML·½·¨²åÈëµ½µ±Ç°ÎĵµÒ»¸öÔªËØÖУ¬Äã»á·¢ÏÖAJAX¼ÓÔØ»ØÀ´µÄ½Å±¾¸ù±¾Ã»ÓÐÖ´ÐС£ÕâÊÇAJAX¿ª·¢Öкܳ£¼ûµÄÎÊÌ⣬Èç¹ûÄã²»ÊÇÒ»Ö±ÔÚÓÃJavaScript¿ò¼Ü×ö¿ª·¢£¬ÏàÐÅÄãÔç¾Í·¢ÏÖÕâ¸öÎÊÌâÁË¡£±¾ÎÄ·ÖÎöÁËÁ½¸ö½â¾ö°ì·¨£¬ÆäÖÐÒ»¸öÊǽ²½âjQuery¿ò¼ÜµÄʵÏÖ¡£
Ò»¡¢ ÎÊÌâÃèÊö
ÏÂÃæ¾Ù¸ö¼òµ¥µÄÀý×Ó£¬ÑÝʾÎÊÌâËùÔÚ¡£ÔÚÏÂÃæµÄÀý×ÓÖУ¬¼ÙÉè±äÁ¿responseText¾ÍÊÇAJAX¼ÓÔصÄHTMLƬ¶ÎÊý¾Ý£¬ÆäÖаüº¬½Å±¾µ¯³öÒ»ÌõÏûÏ¢£¬ÓÃinnerHTML·½·¨²åÈëIDΪajaxDataµÄDIVÖУ¬Äã¿ÉÄÜÆÚÍû¿´µ½µ¯³öÄǸöÏûÏ¢¿ò£¬½á¹ûÄã·¢ÏÖûÓУ¬ÎÊÌâ¾ÍÊÇÕâÑù¡£
<div id="ajaxData"></div>
<script type="text/javascript">
var responseText = '<p>ÕâÊÇÒ»¸ö¶ÎÂä</p><script>alert("ÕâÊÇAJAX¼ÓÔØ»ØÀ´µÄ½Å±¾Æ¬¶Î")</script>';
document.getElementById('ajaxData').innerHTML = responseText;
</script>
¶þ¡¢Á½ÖÖ½â¾ö°ì·¨
1¡¢ ÀûÓÃJavaScriptµÄeval·½·¨Ö´Ðнű¾¡£
±¾·½·¨µÄ¾ßÌåʵÏÖ˼·ÊÇ°ÑxmlHttp.responseTextÖеĽű¾¶¼³éÈ¡³öÀ´£¬²»¹ÜAJAX¼ÓÔصÄHTML°üº¬¶àÉÙ¸ö½Å±¾¿é£¬ÎÒÃǶÔÕÒ³öÀ´µÄ½Å±¾¿é¶¼µ÷ÓÃeval·½·¨Ö´ÐÐËü¼´¿É¡£ÏÂÃæÌṩһ¸ö·â×°ºÃµÄº¯Êý£º
function executeScript(html)
{
var reg = /<script[^>]*>([^\x00]+)$/i;
//¶ÔÕû¶ÎHTMLƬ¶Î°´<\/script>²ð·Ö
var htmlBlock = html.split("<\/script>");
for (var i in htmlBlock)
{
var blocks;//Æ¥ÅäÕýÔò±í´ïʽµÄÄÚÈÝÊý×飬blocks[1]¾ÍÊÇÕæÕýµÄÒ»¶Î½Å±¾ÄÚÈÝ£¬ÒòΪǰÃæreg¶¨ÒåÎÒÃÇÓÃÁËÀ¨ºÅ½øÐÐÁ˲¶»ñ·Ö×é
if (blocks = htmlBlock[i].match(reg))
{
//Çå³ý¿ÉÄÜ´æÔÚµÄ×¢Êͱê¼Ç£¬¶ÔÓÚ×¢Êͽáβ-->¿ÉÒÔºöÂÔ´¦Àí£¬evalÒ»ÑùÄÜÕý³£¹¤×÷
&nbs
Ïà¹ØÎĵµ£º
// ä¯ÀÀÆ÷ÏÔʾÇøÓòµÄ¿íºÍ¸ß£¬ÏòÏ»¹ÔºóÖµ»á±äС¡£
document.body.clientWidth;
document.body.clientHeight;
// ÓëÉÏÃæµÄÁ½¸öÖµÏà±È£¬ÎÒ¾õµÃ¾ÍÊǼÓÉÏÁ˹ö¶¯ÌõµÄ¿íºÍ¸ß
document.body.offsetWidth;
document.body.offsetHeight;
// Õû¸öÍøÒ³µÄ¸ß¶ÈºÍ¿í¶È£¬°üÀ¨¹ö¶¯ÌõÖÐûÓÐÏÔʾ³öÀ´µÄ
document.bod ......
¹«Ë¾ÏîÄ¿ÏëҪʵÏÖÒ»ÖÖ¹¦ÄÜ£º
µ¥»÷Ò»¸ö°´Å¥»ò³¬Á´½Ó£¬È»ºó»á³öÏÖÆäËûµÄ³¬Á´½Ó£¬ÕâʱҪÈÃÆäÖеÄÒ»¸ö³¬Á´½Ó±»µ¥»÷£¬ÒÔÏÔʾһ¸ö³õʼҳÃæ¡££¨¹«Ë¾Ò³ÃæʹÓÃÁËframeset£©
ºÜÏÔÈ»£¬Ö®ºóµÄ³¬Á´½Óµ¥»÷ʼþÐèҪͨ¹ýJavaScriptÀ´´¥·¢¡£
Ò»¿ªÊ¼£¬ÎÒÏëµ½ÁËÓÃjQueryµÄclick()ʼþÀ´´¥·¢³¬Á´½ÓµÄµ¥»÷ʼþ£¨Óëtrigger("click")Ò ......
¹¤¾ß:myeclipse 6.5
jsonÖÐÎĹٷ½£ºhttp://www.json.org/json-zh.html
н¨ÏîÄ¿webs£¬ÔÚWebRootÏÂн¨Ä¿Â¼json
xmlµÄ½âÎö·½Ê½:
------------------------------------------------------------------
1.н¨NewFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<userinfo>
  ......
À´Ô´£ºÍøÂç
headerÎļþ¸ñʽÀࣺ
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'pict' => 'image/x-pict',
'pic' => 'i ......
ShowModalDialogº¯ÊýµÄ¹¦ÄÜ£º
´ò¿ªÒ»¸ö×Ó´°¿Ú£¬²¢ÇÒ¿ÉÓ븸´°¿ÚÏ໥´«µÝÊý¾Ý£¬ËüÓëwindow.openµÄ×î´óÇø±ð¾ÍÔÚÓÚÓÉShowModalDialog´ò¿ª×Ó´°¿Úºó£¬¸¸´°¿Ú½«²»ÄܲÙ×÷¡£
ʹÓ÷½·¨£º
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
²ÎÊý˵Ã÷£º
sURL
±ØÑ¡²ÎÊý£¬ÀàÐÍ£º×Ö·û´®¡£ÓÃÀ´Ö¸¶¨¶Ô»°¿òÒªÏ ......