微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

系统前端基本文件+ajax部分理解

静态页面

一、static:

css

dist

fonts

images

js

model

二、templates:

html

ajax搜索操作:

{ document.getElementById(获取asp文件,注意q参数 xmlhttp.send(); }

<span style="color: #0000ff"><<span style="color: #800000">h3<span style="color: #0000ff">>请在下面的输入框中键入字母(A - Z):<span style="color: #0000ff"></<span style="color: #800000">h3<span style="color: #0000ff">>
<span style="color: #0000ff"><<span style="color: #800000">form <span style="color: #ff0000">action<span style="color: #0000ff">=""<span style="color: #0000ff">><span style="color: #000000">
姓氏:<span style="color: #0000ff"><<span style="color: #800000">input <span style="color: #ff0000">type<span style="color: #0000ff">="text"<span style="color: #ff0000"> id<span style="color: #0000ff">="txt1"<span style="color: #ff0000"> onkeyup<span style="color: #0000ff">="showHint(this.value)" <span style="color: #0000ff">/>
<span style="color: #0000ff"></<span style="color: #800000">form<span style="color: #0000ff">>
<span style="color: #0000ff"><<span style="color: #800000">p<span style="color: #0000ff">>建议:<span style="color: #0000ff"><<span style="color: #800000">span <span style="color: #ff0000">id<span style="color: #0000ff">="txtHint"<span style="color: #0000ff">></<span style="color: #800000">span<span style="color: #0000ff">></<span style="color: #800000">p<span style="color: #0000ff">>

<span style="color: #0000ff"></<span style="color: #800000">body<span style="color: #0000ff">>
<span style="color: #0000ff"></<span style="color: #800000">html<span style="color: #0000ff">>

下面是asp文件代码

<%=-130填充数组 a(1)="Anna" a(2)="Brittany" a(3)="Cinderella" a(4)="Diana" a(5)="Eva" a(6)="Fiona" a(7)="Gunda" a(8)="Hege" a(9)="Inga" a(10)="Johanna" a(11)="Kitty" a(12)="Linda" a(13)="Nina" a(14)="Ophelia" a(15)="Petunia" a(16)="Amanda" a(17)="Raquel" a(18)="Cindy" a(19)="Doris" a(20)="Eve" a(21)="Evita" a(22)="Sunniva" a(23)="Tove" a(24)="Unni" a(25)="Violet" a(26)="Liza" a(27)="Elizabeth" a(28)="Ellen" a(29)="Wenche" a(30)="Vicky"

'<span style="color: #000000">获得来自 URL 的 q 参数
q=ucase(request.querystring(<span style="color: #ff0000">"q"<span style="color: #000000">))

<span style="color: #ff0000">'如果 q 大于 0,则查找数组中的所有提示
if len(q)>0 then
hint=""
for i=1 to 30
if q=ucase(mid(a(i),1,len(q))) then
if hint="" then
hint=a(i)
else
hint=hint & "," & a(i)
end if
end if
next
end if

'如果未找到提示,则输出 <span style="color: #ff0000">"no suggestion"
<span style="color: #ff0000">'否则输出正确的值
if hint="" then
response.write("no suggestion")
else
response.write(hint)
end if
%>

也可以用PHP代码

PHP 填充数组 []="Anna"[]="Brittany"[]="Cinderella"[]="Diana"[]="Eva"[]="Fiona"[]="Gunda"[]="Hege"[]="Inga"[]="Johanna"[]="Kitty"[]="Linda"[]="Nina"[]="Ophelia"[]="Petunia"[]="Amanda"[]="Raquel"[]="Cindy"[]="Doris"[]="Eve"[]="Evita"[]="Sunniva"[]="Tove"[]="Unni"[]="Violet"[]="Liza"[]="Elizabeth"[]="Ellen"[]="Wenche"[]="Vicky"<span style="color: #008000">//<span style="color: #008000">获得来自 URL 的 q 参数
<span style="color: #800080">$q
=<span style="color: #800080">$_GET
["q"<span style="color: #000000">];

<span style="color: #008000">//<span style="color: #008000">如果 q 大于 0,则查找数组中的所有提示
<span style="color: #0000ff">if (<span style="color: #008080">strlen(<span style="color: #800080">$q) > 0<span style="color: #000000">)
{
<span style="color: #800080">$hint=""<span style="color: #000000">;
<span style="color: #0000ff">for(<span style="color: #800080">$i=0; <span style="color: #800080">$i<<span style="color: #008080">count(<span style="color: #800080">$a); <span style="color: #800080">$i++<span style="color: #000000">)
{
<span style="color: #0000ff">if (<span style="color: #008080">strtolower(<span style="color: #800080">$q)==<span style="color: #008080">strtolower(<span style="color: #008080">substr(<span style="color: #800080">$a[<span style="color: #800080">$i],<span style="color: #008080">strlen(<span style="color: #800080">$q<span style="color: #000000">))))
{
<span style="color: #0000ff">if (<span style="color: #800080">$hint==""<span style="color: #000000">)
{
<span style="color: #800080">$hint=<span style="color: #800080">$a[<span style="color: #800080">$i<span style="color: #000000">];
}
<span style="color: #0000ff">else<span style="color: #000000">
{
<span style="color: #800080">$hint=<span style="color: #800080">$hint.",".<span style="color: #800080">$a[<span style="color: #800080">$i<span style="color: #000000">];
}
}
}
}

<span style="color: #008000">//<span style="color: #008000"> 如果未找到提示,则把输出设置为 "no suggestion"
// 否则设置为正确的值
<span style="color: #0000ff">if (<span style="color: #800080">$hint == ""<span style="color: #000000">)
{
<span style="color: #800080">$response="no suggestion"<span style="color: #000000">;
}
<span style="color: #0000ff">else<span style="color: #000000">
{
<span style="color: #800080">$response=<span style="color: #800080">$hint<span style="color: #000000">;
}

<span style="color: #008000">//<span style="color: #008000">输出响应
<span style="color: #0000ff">echo <span style="color: #800080">$response<span style="color: #000000">;
?>

所学项目相关:

编辑用户

$(".userEdit").click( username = $().parents("tr").children('td').eq(1 ChineseName = $().parents("tr").children('td').eq(2 role =$().parents("tr").children('td').eq(3neseName,role) $('#usernameSpan''#newChineseNameEdit'neseName) (role=='超级管理员''#selectRoleEdit').val('superlUser''#selectRoleEdit').val('normalUser'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐