请教各位大虾javascript 与javabean 之间能否互相调用实现通讯? 如果java bean在服务器端我们使用的是http协议javascript 只能post到一个jsp/servlet,然后调用javabean如果javabean在客户端(applet)可以办到的,使用js调用applet 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我要做查数据库某个表中的所有字段、字段内容,通过select框显示出来,让用户选择,当选某个字段必须将该字段的内容在下一个select框中下拉出来。这样做就需要有查询字段的bean 和控制select框的script但不知道如何将二者联系起来用。 javabean在服务器端运行,javascript在客户端,二者部可以直接调用,但可以用javascript刷新页面来调用javabean!!!你要做的是多级关联下拉菜单吧,试试这个:先把所有的数据取出来,你自己组织吧!!!要不然就刷新页面<FORM name="isc"><table border="0" cellspacing="0" cellpadding="0"> <tr align="center"> <td nowrap height="11"> <select name="example" size="1" onChange="redirect(this.options.selectedIndex)"><option selected>---Select1-------------</option><option>Webmaster Sites</option><option>News Sites</option></select><select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)"><option value=" " selected> </option><option value=" " selected>---Select2--------------</option><option value=" " selected>---Select2--------------</option></select><select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)"><option value=" " selected> </option><option value=" " selected>---Select3----------------</option><option value=" " selected>---Select3----------------</option></select><script><!--/*Triple Combo Script CreditBy Hamid Cheheltani/ Website Abstraction (http://www.wsabstract.com)Visit http://wsabstract.com for this and over 400+ other scripts*/var groups=document.isc.example.options.lengthvar group=new Array(groups)for (i=0; i<groups; i++)group[i]=new Array()group[0][0]=new Option("---Select2---"," ");group[1][0]=new Option("Now Select This One"," ");group[1][1]=new Option("JavaScript","47");group[1][2]=new Option("DHTML","46");group[1][3]=new Option("CGI","45");group[2][0]=new Option("Now Select This One"," ");group[2][1]=new Option("General News","115");group[2][2]=new Option("Technology News","116"); var temp=document.isc.stage2function redirect(x){for (m=temp.options.length-1;m>0;m--)temp.options[m]=nullfor (i=0;i<group[x].length;i++){temp.options[i]=new Option(group[x][i].text,group[x][i].value)}temp.options[0].selected=trueredirect1(0)}var secondGroups=document.isc.stage2.options.lengthvar secondGroup=new Array(groups)for (i=0; i<groups; i++) {secondGroup[i]=new Array(group[i].length)for (j=0; j<group[i].length; j++) {secondGroup[i][j]=new Array() }}secondGroup[0][0][0]=new Option("---Select 3---"," ");secondGroup[1][0][0]=new Option("---Select 3---"," ");secondGroup[1][1][0]=new Option("Now Select This One"," ");secondGroup[1][1][1]=new Option("Website Abstraction","http://wsabstract.com");secondGroup[1][1][2]=new Option("JavaScript for the non programmer","http://webteacher.com/javascript/");secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net");secondGroup[1][2][0]=new Option("Now Select This One"," ");secondGroup[1][2][1]=new Option("Dynamic Drive","http://www.dynamicdrive.com");secondGroup[1][2][2]=new Option("Beginner\'s Guide to DHTML","http://www.geocities.com/ResearchTriangle/Facility/4490/");secondGroup[1][2][3]=new Option("Web Coder","http://webcoder.com/");secondGroup[1][3][0]=new Option("Now Select This One"," ");secondGroup[1][3][1]=new Option("CGI Resources","http://www.cgi-resources.com");secondGroup[1][3][2]=new Option("Ada\'s Intro to CGI","http://adashimar.hypermart.net/");secondGroup[2][0][0]=new Option("---Select 3---"," ");secondGroup[2][1][0]=new Option("Now Select This One"," ");secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com");secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com");secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com");secondGroup[2][2][0]=new Option("Now Select A Page"," ");secondGroup[2][2][1]=new Option("News.com","http://www.news.com");secondGroup[2][2][2]=new Option("Wired","http://www.wired.com");var temp1=document.isc.stage3function redirect1(y){for (m=temp1.options.length-1;m>0;m--)temp1.options[m]=nullfor (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)}temp1.options[0].selected=true}function redirect2(z){window.location=temp1[z].value}//--></script> </td> </tr></table></FORM><p><font face="arial" size="-2">This free script provided by</font><br><font face="arial, helvetica" size="-2"><a href="http://wsabstract.com">WebsiteAbstraction</a></font></p> 1、要用老大您这样的方法就要多次查询表,然后都放进OPTION中待选择,是能实现,但要求硬件配置太高了吧?2、如果表很多,库很大,是不是机器就要崩溃了?3、刷新本页的话是不是太土了?你能满意吗?另外你还需要利用session这样的东西。请问各位大虾,是否还有更好的解决方法呢? 老师说这是一个反射可我弄不懂什么意思 马士兵说重写equals方法必须重写HashCode方法,有疑问! 安装完java主程序后为什么要配置环境变量? 这个小程序怎么编译不了? 构造函数和普通函数有什么不同 在线等,安装MyEclipse后打开报错 如何将数字转换成字符串? JFrame 在WinXP中出现的不弹出问题 试想一个方法/数据结构,实现无限长度有理数的四则及混合运算。 如何把一个字符串中所有指定的字符删除? 两个jar文件在 applet网页中如何??? Object 里的wait() 和Thread 里面的yield()有什么区别
你要做的是多级关联下拉菜单吧,试试这个:
先把所有的数据取出来,你自己组织吧!!!
要不然就刷新页面<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11"> <select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>Webmaster Sites</option>
<option>News Sites</option>
</select><select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select2--------------</option>
<option value=" " selected>---Select2--------------</option>
</select><select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select3----------------</option>
<option value=" " selected>---Select3----------------</option>
</select><script>
<!--/*
Triple Combo Script Credit
By Hamid Cheheltani/ Website Abstraction (http://www.wsabstract.com)
Visit http://wsabstract.com for this and over 400+ other scripts
*/var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()group[0][0]=new Option("---Select2---"," ");group[1][0]=new Option("Now Select This One"," ");
group[1][1]=new Option("JavaScript","47");
group[1][2]=new Option("DHTML","46");
group[1][3]=new Option("CGI","45");group[2][0]=new Option("Now Select This One"," ");
group[2][1]=new Option("General News","115");
group[2][2]=new Option("Technology News","116"); var temp=document.isc.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
redirect1(0)
}var secondGroups=document.isc.stage2.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++) {
secondGroup[i]=new Array(group[i].length)
for (j=0; j<group[i].length; j++) {
secondGroup[i][j]=new Array() }}secondGroup[0][0][0]=new Option("---Select 3---"," ");
secondGroup[1][0][0]=new Option("---Select 3---"," ");
secondGroup[1][1][0]=new Option("Now Select This One"," ");
secondGroup[1][1][1]=new Option("Website Abstraction","http://wsabstract.com");
secondGroup[1][1][2]=new Option("JavaScript for the non programmer","http://webteacher.com/javascript/");
secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net");secondGroup[1][2][0]=new Option("Now Select This One"," ");
secondGroup[1][2][1]=new Option("Dynamic Drive","http://www.dynamicdrive.com");
secondGroup[1][2][2]=new Option("Beginner\'s Guide to DHTML","http://www.geocities.com/ResearchTriangle/Facility/4490/");
secondGroup[1][2][3]=new Option("Web Coder","http://webcoder.com/");secondGroup[1][3][0]=new Option("Now Select This One"," ");
secondGroup[1][3][1]=new Option("CGI Resources","http://www.cgi-resources.com");
secondGroup[1][3][2]=new Option("Ada\'s Intro to CGI","http://adashimar.hypermart.net/");secondGroup[2][0][0]=new Option("---Select 3---"," ");
secondGroup[2][1][0]=new Option("Now Select This One"," ");
secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com");
secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com");
secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com");secondGroup[2][2][0]=new Option("Now Select A Page"," ");
secondGroup[2][2][1]=new Option("News.com","http://www.news.com");
secondGroup[2][2][2]=new Option("Wired","http://www.wired.com");var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}function redirect2(z){
window.location=temp1[z].value
}//-->
</script> </td>
</tr>
</table>
</FORM><p><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://wsabstract.com">Website
Abstraction</a></font></p>
2、如果表很多,库很大,是不是机器就要崩溃了?
3、刷新本页的话是不是太土了?你能满意吗?另外你还需要利用session这样的东西。请问各位大虾,是否还有更好的解决方法呢?