javascript字符串处理

<script>
function a(){
document.form1.action="sel.asp"
document.form1.h1.value="按钮a"
document.form1.submit();
}

function b(){
document.form1.action="sel.asp"
document.form1.h1.value="按钮b"
document.form1.submit();
}

function c(){
document.form1.action="sel.asp"
document.form1.h1.value="按钮c"
document.form1.submit();
}
</script>
<form method="post">
  <input type="text" />
  <input type="hidden" >
  <input type="button" value="按钮1" />
  <input type="button" value="按钮2" />
  <input type="button" value="按钮3" />
</form>
<script>
var str="China"
document.write(str.length)
document.write("<br/>")
document.write(str.bold())
document.write("<br/>")
document.write(str.substring(0,3))
document.write("<br/>")
document.write(str.fontsize(20))
document.write("<br/>")
document.write(str.fontcolor("blue"))
document.write("<br/>")
document.write(str.replace("C","D"))
document.write("<br/>")
document.write(str.toUpperCase())
document.write("<br/>")
document.write(str.toLowerCase())
document.write("<br/>")
document.write(str.substr(0))
document.write("<br/>")
document.write(str.concat("  i love you"))
document.write("<br/>")
document.write(str.indexOf("in"))   /* China  从0开始起,i在第三个位置,数字为2  等价于Vbscript中instr */
document.write("<br/>")
document.write(str.lastIndexOf("a"))  /* 反向查找 等价于Vbscript中instrrev */
document.write("<br/>")
document.write(str.charAt(2))
</script>

sel.asp

<%
select case request("h1")
case "按钮a":
response.write "button1"
case "按钮b":
response.write "button2"
case "按钮c":
response.write "button3"
end select
%>

<%response.write "<br>"%>

<%=request("username")%>

    A+
发布日期:2010年03月07日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: