问题都是一个:取服务端数据并 回填 或 使用http://jkisjk.vip.sina.com/html/getDataFromServer.htm以上示例是取了服务端数据后当作一个input的值回填
楼主需要的是取了服务端数据后当作select的内容来更新级联的下拉框
楼主需要的是取了服务端数据后当作select的内容来更新级联的下拉框
解决方案 »
- ext4关于store更新的经典疑难问题
- DW问题!!高手帮忙!
- 已知屏幕几个点的坐标,想把一个图标分别放在这几个点上,用javascript, 该怎么办,多谢指点
- js里的replace怎么用?急,谢谢!
- 正则表达式问题,在线等...感谢!
- 请问高手, 我如何用js检测ie有没有安装插件
- 如何获得textarea里被选择的内容。
- 百度偏移问题和AJAX连接问题,求指导。
- 快!大家都来!最近我又心血来潮做了个类似frontpage的网页编辑器,开砸吧
- angular cli 生成的工程 ng serve的时候运行到95% emitting LicenseWebpackPlugin卡住。
- 如何让javascript识别自己的对象
- 为何onmouseover和onmouseout在框架页中效率会入此这差
你的意思是这样的吗:
他的以下代码是写死在javascript里,
而你的数据应该是从数据库里得到---
var topCat=new Array();
topCat["Apollo"] = new Array (
new Array (
new cg(21254,"51625A"),
怎樣用Javascript讀出每一條記錄三個字段的內容,並放到數組裡?!
就像:
arraya(1)="標題1"
arrayb(1)="內容1"
arrayc(1)="作者1"arraya(2)="標題2"
arrayb(2)="內容2"
arrayc(2)="作者2"
sub ShowSearch(ShowType)
dim count
if ShowType<>1 and ShowType<>2 then
ShowType=1
end if
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= left(rs("SmallClassName"),22)%>","<%= left(rs("BigClassName"),22)%>","<%= left(rs("SmallClassName"),22)%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<table border="0" cellpadding="2" cellspacing="0">
<form method="Get" name="myform" action="search.asp">
<tr><td height="28">
<select name="Field" size="1">
<option value="Title" selected>产品名称</option>
<option value="Content">产品说明</option>
</select>
<%if ShowType=1 then%>
</td></tr>
<tr><td height="28">
<%end if%>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected value="">所有大类</option>
<%
if not (rsBigClass.bof and rsBigClass.eof) then
rsBigClass.movefirst
do while not rsBigClass.eof
response.Write "<option value='" & trim(rsBigClass("BigClassName")) & "'>" & trim(rsBigClass("BigClassName")) & "</option>"
rsBigClass.movenext
loop
end if
%>
</select>
<%if ShowType=1 then%>
</td></tr>
<tr><td height="28">
<%end if%>
<select name="SmallClassName">
<option selected value="">所有小类</option>
</select>
<%if ShowType=1 then%>
</td></tr>
<tr><td height="28">
<%end if%>
<input type="text" name="keyword" size=15 value="关键字" maxlength="50" onFocus="this.select();">
<input type="submit" name="Submit" value="产品搜索">
</td></tr>
</form>
</table>
<%
end sub
要分清前台代码和后台程序的关系
对于网页,后台程序运行的结果是一个文本文件,
它将这个文本文件传到客户端,由浏览器解释成一个页面,并可以有一些前台角本做成的效果。如果是jsp,你的要求可以做成这样的<%
for(int i=0;i<10;i++)
{
%>
arraya[<%=i%>]="<%=titleArray[i]%>";
arrayb[<%=i%>]="<%=contentArray[i]%>";
arrayc[<%=i%>]="<%=authorArray[i]%>";
<%
}
%>
是什么代码啊?好像是jsp 代码把?
一个for循环,用jsp或asp实现,差别不会很大,我认为。
不想再说什么
老兄,好像你很强啊。其实你也是懂点皮毛。告诉你asp中不同脚本之间根本不可能赋值
要是你能赋值,真的算你厉害了,你比发明asp的人都厉害了
办法我想到了,,把数据写到js文件中去data.js其中内容大致为:
var data=new Array(500);
...
data[1]=Array('標題1','內容1','作者1');
data[2]=Array('標題2', '內容2','作者2');
...
for(int i=0;i<10;i++)
{
%>
arraya[<%=i%>]="<%=titleArray[i]%>";
arrayb[<%=i%>]="<%=contentArray[i]%>";
arrayc[<%=i%>]="<%=authorArray[i]%>";
<%
}
%>我也知道这个问题在jsp中,根本不是问题
第一次看见猩猩光火 呵呵:)<input type="hidden" value...>...
你用这个过渡一下也许可以ASP是服务端代码, JS是客户端脚本
免得影响过年的心情。“首先是有人在攻击我才攻击人家”
希望这一句不是在说JK,
看了一下自己的留言,
我最严厉的一句话就是“有点外行”
不过这也的确是心里想的(俺好歹也做过一年多的asp,尽管那是很多年前的事),不是拿来气人的当然,也不赞同懒猫的话
这只是一个学习态度的问题,
与人品问题还有一定差别。
做人要厚道
jsp怎么了?
jsp就可以直接和客户端脚本交流了?