[转载]转换字母ASCII值的简单ASP小程序
信息来源:小新技术网ASP过时了,也需要学习啊,感觉这个转换字母 ASCII值的简单ASP程序,挺有意思,写出来大家也看下啊,错误还请指正。有什么问题请到论坛发帖,或直接找我QQ:12231446交流
演示地址:[url]http://www.maxin.cn/book/ASCII/ASCII.ASP[/url]
[code]<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>输入字符转换为ASCII值的简单小程序--新水年华[url]www.maxin.cn</title>[/url]
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
}
.style1 {font-size: 18px}
.style3 {
font-size: 12px;
color: #333333;
}
.style4 {
font-size: 14px;
color: #333333;
}
.style5 {
font-size: 16px;
font-weight: bold;
color: #990000;
}
-->
</style></head>
<body>
<div align="center">
<% if request.form("submit") <> "" then %>
</div>
<h1 align="center" class="style1">新水年华告诉你结果</h1><br>
<form method="post">
<input type="button" value="返回上一页"
onclick="history.go(-1);return true;">
</form>
<div align="center"><br>
<br>
<br>
<%
function safeconvert(strorig)
dim strtemp
if isnull(strorig) then
strtemp = strorig
else
strtemp = server.htmlencode(strorig)
strtemp = replace(strtemp,chr(10),"<br>")
strtemp = replace(strtemp," "," ")
strtemp = replace(strtemp,chr(9),"    ")
end if
safeconvert = strtemp
end function
dim a
a = request.form("request")
a = safeconvert(a)
response.write "输入字母的ASCII的值是:"& asc(a) & vbcrlf
else
%>
<br>
<br>
<span class="style5">输入字符转换为ASCII值的简单小程序<br>
<br>
<br>
<br>
<br>
</span></div>
<h1 align="center" class="style4">在此输入需要转换为ASCII值的字母:</h1>
<form name="frm_request" method="post" action="ASCII.asp">
<div align="center">
<input onfocus=this.select() onmouseover=this.focus() name="request" type="text" value="输入需要转换为ASCII值的字母" size="30" maxlength="2">
<br>
<input name="submit" type="submit" value="提交">
</div>
</form>
<div align="center">
<% end if %>
<br>
<br>
<br>
-----------------------------------------------------------------------------------<br>
<br>
<a href="[url]http://www.maxin.cn[/url]" target="_blank" class="style3">新水年华--小新技术网[url]www.maxin.cn</a></div>[/url]
</body>
</html>[/code]
页:
[1]