欢迎来到天天文库
浏览记录
ID:51958100
大小:29.00 KB
页数:7页
时间:2020-03-20
《JSP和JavaScript的搭配使用和相互访问.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、下面我们再来看一看,JavaScript对JSP方法和JSP对JavaScript的调用。这两个调用都有一个共同点,那就是需要对页面进行提交,在用Hidden设置几个隐藏参数。JSP根据获得的参数再进行相应的处理,就可以了。也许有的人已经不太明白了,那我们还是用一个程序来说明问题吧!程序二:一个服务器获得客户端信息的Web页面。他获得了客户端的一些屏幕设置,并把它们记录在数据库里。GetClientInfo.jsp<%@pagecontentType="text/html;charset=utf-8"language="java"%><%@i
2、mport="java.sql.*"%>
3、E="frmClient"METHOD="POST">4、="HIDDEN"NAME="iClientHeight">frmClient.iScreenWidth.value=screen.width;frmClient.iScreenHeight.value=screen.height;frmClient.iColorDepth.value=screen.colorDepth;frmClient.sBrowseNa5、me.value=navigator.appName;frmClient.sBrowseVer.value=navigator.appVersion;frmClient.iClientHeight.value=screen.availHeight;frmClient.iClientWidth.value=screen.availWidth;frmClient.submit();<%}else{%>6、00C04FD7081Fwidth="32"height="32">varMerlinID;varMerlinACS;objMSAgent.Connected=true;MerlinLoaded=LoadLocalAgent(MerlinID,MerlinACS);Merlin=objMSAgent.Characters.Character(MerlinID);Merlin.Show();Merlin.Play("Su7、rprised");Merlin.Speak("<%="Hello?"%>");Merlin.Play("GestureLeft");Merlin.Think("<%="Thisisajspvariant"%>");Merlin.Play("Pleased");Merlin.Think("<%="JavaScriptusesjspvariants"%>");Merlin.Play("GestureDown");Merlin.Speak("<%="Bye!soEasy!"%>");Merlin.Hide();functionLoadLocalA8、gent(CharID,CharACS){LoadReq=objMSAgent.Characters.Load(CharID,CharACS);return(tru
4、="HIDDEN"NAME="iClientHeight">frmClient.iScreenWidth.value=screen.width;frmClient.iScreenHeight.value=screen.height;frmClient.iColorDepth.value=screen.colorDepth;frmClient.sBrowseNa
5、me.value=navigator.appName;frmClient.sBrowseVer.value=navigator.appVersion;frmClient.iClientHeight.value=screen.availHeight;frmClient.iClientWidth.value=screen.availWidth;frmClient.submit();<%}else{%>6、00C04FD7081Fwidth="32"height="32">varMerlinID;varMerlinACS;objMSAgent.Connected=true;MerlinLoaded=LoadLocalAgent(MerlinID,MerlinACS);Merlin=objMSAgent.Characters.Character(MerlinID);Merlin.Show();Merlin.Play("Su7、rprised");Merlin.Speak("<%="Hello?"%>");Merlin.Play("GestureLeft");Merlin.Think("<%="Thisisajspvariant"%>");Merlin.Play("Pleased");Merlin.Think("<%="JavaScriptusesjspvariants"%>");Merlin.Play("GestureDown");Merlin.Speak("<%="Bye!soEasy!"%>");Merlin.Hide();functionLoadLocalA8、gent(CharID,CharACS){LoadReq=objMSAgent.Characters.Load(CharID,CharACS);return(tru
6、00C04FD7081Fwidth="32"height="32">varMerlinID;varMerlinACS;objMSAgent.Connected=true;MerlinLoaded=LoadLocalAgent(MerlinID,MerlinACS);Merlin=objMSAgent.Characters.Character(MerlinID);Merlin.Show();Merlin.Play("Su
7、rprised");Merlin.Speak("<%="Hello?"%>");Merlin.Play("GestureLeft");Merlin.Think("<%="Thisisajspvariant"%>");Merlin.Play("Pleased");Merlin.Think("<%="JavaScriptusesjspvariants"%>");Merlin.Play("GestureDown");Merlin.Speak("<%="Bye!soEasy!"%>");Merlin.Hide();functionLoadLocalA
8、gent(CharID,CharACS){LoadReq=objMSAgent.Characters.Load(CharID,CharACS);return(tru
此文档下载收益归作者所有