5: 这时就可以在html或jsp中调用此class文件了,调用方式如下 一下为测试的 html文件 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>DWR - My First AJAX</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script type='text/javascript' src='dwr/interface/MyTest.js'></script> <script type='text/javascript' src='dwr/interface/showData.js'></script> <script type='text/javascript' src='dwr/engine.js'></script> <script type='text/javascript' src='dwr/util.js'></script> <script language="javascript"> var mycall=function callBack(data){ DWRUtil.setValue("demo1",data); DWRUtil.setValue("demo2","leo_wang"); DWRUtil.setValue("userName",data); } function showMyName(){ //MyTest.getMyName(mycall); showData.getUserName(mycall); } function clearName(){ demo1.value=""; demo2.value=""; } </script> </head> <body> <h1>Ajax Test Page</h1> <input type="button" value="setMyName" onclick="javascript:showMyName()"> <input type="button" value="Clear" onclick="javascript:clearName()"><br> <input type="text" id="demo1"> <input type="text" id="demo2"> <input type="test" id="userName">userName </body></html>
(编辑:aniston)
·2024年12月目录 ·2024年11月目录 ·2024年10月目录 ·2024年9月目录 ·2024年8月目录 ·2024年7月目录 ·2024年6月目录 ·2024年5月目录 ·2024年4月目录 ·2024年3月目录 ·2024年2月目录 ·2024年1月目录 ·2023年12月目录 ·2023年11月目录