|
楼主 |
发表于 2007-5-11 15:10:05
|
显示全部楼层
比如 这个PHP文件
- <?php
- //Includes
- require_once("vcl/vcl.inc.php");
- use_unit("dbgrids.inc.php");
- use_unit("db.inc.php");
- use_unit("dbtables.inc.php");
- use_unit("forms.inc.php");
- use_unit("extctrls.inc.php");
- use_unit("stdctrls.inc.php");
- //Class definition
- class Index extends Page
- {
- public $Label1 = null;
- public $Button1 = null;
- function Button1JSClick($sender, $params)
- {
- //Dump the call using Ajax to the Button1Click event
- echo $this->Button1->ajaxCall("Button1Click");
- ?>
- //Return false to prevent the button submit the form
- return(false);
- <?php
- }
- function Button1Click($sender, $params)
- {
- $this->Button1->Caption="clicked Ajax ".date("Y-m-d H:i:s");
- $this->Label1->Caption="Hello from Ajax!! ".date("Y-m-d H:i:s");
- $this->Label1->Color="#".dechex(rand(0,0xFFFFFF));
- }
- }
- global $application;
- global $Index;
- //Creates the form
- $Index=new Index($application);
- //Read from resource file
- $Index->loadResource(__FILE__);
- //Shows the form
- $Index->show();
- ?>
复制代码
正常的运行结果是这样的
- <!-- Index begin -->
- <html >
- <head>
- <script type="text/javascript" src="/vcl-bin/js/common.js"></script>
- <script type="text/javascript">
- var xajaxRequestUri="http://www.qadram.com/vcl4php/samples/Ajax/Basic/basicajax.php";
- var xajaxDebug=false;
- var xajaxStatusMessages=false;
- var xajaxWaitCursor=true;
- var xajaxDefinedGet=0;
- var xajaxDefinedPost=1;
- var xajaxLoaded=false;
- function xajax_ajaxProcess(){return xajax.call("ajaxProcess", arguments, 1);}
- </script>
- <script type="text/javascript" src="/vcl-bin/xajax/xajax_js/xajax.js"></script>
- <script type="text/javascript">
- window.setTimeout(function () { if (!xajaxLoaded) { alert('Error: the xajax Javascript file could not be included. Perhaps the URL is incorrect?\nURL: /vcl-bin/xajax/xajax_js/xajax.js'); } }, 6000);
- </script>
- <title>Basic Ajax Example</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <script type="text/javascript">
- <!--
- function Button1JSClick(event)
- {
- var event = event || window.event;
- var params=null;
- xajax_ajaxProcess('Index','Button1',params,'Button1Click',xajax.getFormValues('Index'));
- //Return false to prevent the button submit the form
- return(false);
-
- }
- function Button1ClickWrapper(event, hiddenfield, submitvalue, wrappedfunc)
- {
- var event = event || window.event;
- submit1=true;
- submit2=true;
- if (typeof(wrappedfunc) == 'function') submit1=wrappedfunc(event);
- hiddenfield.value = submitvalue;
- if ((hiddenfield.form.onsubmit) && (typeof(hiddenfield.form.onsubmit) == 'function')) submit2=hiddenfield.form.onsubmit();
- if ((submit1) && (submit2)) hiddenfield.form.submit();
- return false;
- }
- -->
- </script>
- </head>
- <body style=" margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; " >
- <form style="margin-bottom: 0" id="Index" name="Index" method="post" action="/vcl4php/samples/Ajax/Basic/basicajax.php">
- <table width="800" style="height:600px" border="0" cellpadding="0" cellspacing="0" ><tr><td valign="top">
- <div id="Button1_outer" style="Z-INDEX: 0; LEFT: 16px; WIDTH: 240px; POSITION: absolute; TOP: 14px; HEIGHT: 58px">
- <input type="submit" id="Button1" name="Button1" value="Button1" onclick="return Button1ClickWrapper(event, document.forms[0].Button1SubmitEvent, 'Button1_Button1Click', Button1JSClick)" style=" font-family: Verdana; font-size: 10px; height:58px;width:240px;" tabindex="0" /><input type="hidden" id="Button1SubmitEvent" name="Button1SubmitEvent" value="" />
- </div>
- <div id="Label1_outer" style="Z-INDEX: 1; LEFT: 272px; WIDTH: 328px; POSITION: absolute; TOP: 16px; HEIGHT: 56px">
- <div id="Label1" style=" font-family: Verdana; font-size: 10px; height:56px;width:328px;" >Label1</div>
- </div>
- </td></tr></table>
- </form></body>
- </html>
- <!-- Index end -->
复制代码
我这个却这样了
- <!-- Index begin -->
- <html >
- <head>
- <script type="text/javascript" src="file:///c:/program files/codegear/delphi for php/1.0/vcl/js/common.js"></script>
- <script type="text/javascript">
- var xajaxRequestUri="http://localhost:3569/basicajax.php?restore_session=1&DBGSESSID=1";
- var xajaxDebug=false;
- var xajaxStatusMessages=false;
- var xajaxWaitCursor=true;
- var xajaxDefinedGet=0;
- var xajaxDefinedPost=1;
- var xajaxLoaded=false;
- function xajax_ajaxProcess(){return xajax.call("ajaxProcess", arguments, 1);}
- </script>
- <script type="text/javascript" src="file:///c:/program files/codegear/delphi for php/1.0/vcl/xajax/xajax_js/xajax.js"></script>
- <script type="text/javascript">
- window.setTimeout(function () { if (!xajaxLoaded) { alert('Error: the xajax Javascript file could not be included. Perhaps the URL is incorrect?\nURL: file:///c:/program files/codegear/delphi for php/1.0/vcl/xajax/xajax_js/xajax.js'); } }, 6000);
- </script>
- <title>Basic Ajax Example</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <script type="text/javascript">
- <!--
- function Button1JSClick(event)
- {
- var event = event || window.event;
- var params=null;
- xajax_ajaxProcess('Index','Button1',params,'Button1Click',xajax.getFormValues('Index'));
- //Return false to prevent the button submit the form
- return(false);
-
- }
- function Button1ClickWrapper(event, hiddenfield, submitvalue, wrappedfunc)
- {
- var event = event || window.event;
- submit1=true;
- submit2=true;
- if (typeof(wrappedfunc) == 'function') submit1=wrappedfunc(event);
- hiddenfield.value = submitvalue;
- if ((hiddenfield.form.onsubmit) && (typeof(hiddenfield.form.onsubmit) == 'function')) submit2=hiddenfield.form.onsubmit();
- if ((submit1) && (submit2)) hiddenfield.form.submit();
- return false;
- }
- -->
- </script>
- </head>
- <body style=" margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; " >
- <form style="margin-bottom: 0" id="Index" name="Index" method="post" action="/basicajax.php">
- <table width="800" style="height:600px" border="0" cellpadding="0" cellspacing="0" ><tr><td valign="top">
- <div id="Button1_outer" style="Z-INDEX: 0; LEFT: 16px; WIDTH: 240px; POSITION: absolute; TOP: 14px; HEIGHT: 58px">
- <input type="submit" id="Button1" name="Button1" value="Button1" onclick="return Button1ClickWrapper(event, document.forms[0].Button1SubmitEvent, 'Button1_Button1Click', Button1JSClick)" style=" font-family: Verdana; font-size: 10px; height:58px;width:240px;" tabindex="0" /><input type="hidden" id="Button1SubmitEvent" name="Button1SubmitEvent" value="" />
- </div>
- <div id="Label1_outer" style="Z-INDEX: 1; LEFT: 272px; WIDTH: 328px; POSITION: absolute; TOP: 16px; HEIGHT: 56px">
- <div id="Label1" style=" font-family: Verdana; font-size: 10px; height:56px;width:328px;" >Label1</div>
- </div>
- </td></tr></table>
- </form></body>
- </html>
- <!-- Index end -->
复制代码
正确的是 <script type="text/javascript" src="/vcl-bin/js/common.js"></script>
我运行后是这样的<script type="text/javascript" src="file:///c:/program files/codegear/delphi for php/1.0/vcl/js/common.js"></script> |
|