课后作业(五)String对象的常用属性和方法
2009-06-30 19:40
781 查看
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<p>
<input type="text" id="da" />
<input type="button" value="换成大写" onclick="da()" />
<input type="text" id="da1" />
<p>
<input type="text" id="xiao" />
<input type="button" value="换成小写" onclick="xiao()" />
<input type="text" id="xiao1" />
<p>
<input type="text" id="huoqu1" />
<input type="text" id="huoqu2" size="5"/>确认截取长度
<input type="button" value="获取字符串" onclick="jiequ()"/>
<input type="text" id="huoqu3" />
<p>
<input type="text" id="chazhao1" />
<input type="button" value="查找@字符" onclick="cha()"/>
<input type="text" id="chaozhao2" />
</body>
<script language="javascript">
function da()
{
var a = document.getElementById("da").value;
document.getElementById("da1").value = a.toUpperCase();
}
function xiao()
{
var a = document.getElementById("xiao").value;
document.getElementById("xiao1").value = a.toLowerCase();
}
function jiequ()
{
var a=new String (document.getElementById("huoqu1").value);
document.getElementById("huoqu3").value=a.substring(0,parseInt(document.getElementById("huoqu2").value));
}
function cha()
{
var a=new String (document.getElementById("chazhao1").value);
document.getElementById("chaozhao2").value=a.indexOf("@",0)+1;
}
</script>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<p>
<input type="text" id="da" />
<input type="button" value="换成大写" onclick="da()" />
<input type="text" id="da1" />
<p>
<input type="text" id="xiao" />
<input type="button" value="换成小写" onclick="xiao()" />
<input type="text" id="xiao1" />
<p>
<input type="text" id="huoqu1" />
<input type="text" id="huoqu2" size="5"/>确认截取长度
<input type="button" value="获取字符串" onclick="jiequ()"/>
<input type="text" id="huoqu3" />
<p>
<input type="text" id="chazhao1" />
<input type="button" value="查找@字符" onclick="cha()"/>
<input type="text" id="chaozhao2" />
</body>
<script language="javascript">
function da()
{
var a = document.getElementById("da").value;
document.getElementById("da1").value = a.toUpperCase();
}
function xiao()
{
var a = document.getElementById("xiao").value;
document.getElementById("xiao1").value = a.toLowerCase();
}
function jiequ()
{
var a=new String (document.getElementById("huoqu1").value);
document.getElementById("huoqu3").value=a.substring(0,parseInt(document.getElementById("huoqu2").value));
}
function cha()
{
var a=new String (document.getElementById("chazhao1").value);
document.getElementById("chaozhao2").value=a.indexOf("@",0)+1;
}
</script>
</html>
相关文章推荐
- js中String对象和Array对象的常用方法和属性
- JS教程:String对象及其常用属性以及方法
- String对象常用方法和属性
- 【JS基础回顾】String对象及其常用属性以及方法
- JS中Array对象和String对象的常用方法
- JS面向对象组件(三)--面向对象中的常用属性和方法
- 32-JavaScript-DOM-BOM简介-node常用方法和属性-window对象常用方法
- ajax中常用对象的属性及方法总结
- Java String对象的介绍和一些常用的方法
- Math对象常用属性与方法详解
- XMLHttpRequest对象属性及常用方法
- String常用方法及属性
- ajax对象常用属性,事件,方法大小写问题的总结
- OC总结----类的方法.继承.NSString类的常用方法.NSMutableString 类的方法.数组类.字典类.block语法以及数组排序高级.属性.category (分类,类目).延展,等
- 数据表DataTable对象的常用属性及常用方法
- DOM对象常用对象的方法和属性
- js String对象中常用方法小结(字符串操作)
- JavaScript String 对象常用方法
- WINCC中使用ADO对象连接数据库 例子 常用属性 方法 原创
- String对象中常用方法