求大神帮忙解决
<!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=utf-8" />
<title>无标题文档</title>
<script>
function wenben(){
var wenben=document.form1.wenben.value;
alert(wenben);
if(wenben.length==0){
alert("文本字符串不存在!");
return ;
}
var panduan=document.form1.panduan.value;
if(panduan.length==0){
alert("需要判断的字符串为空");
return ;
}
alert(wenben.match(panduan));
var start=document.form1.start.value;
var length=document.form1.length.value;
alert(wenben.substring(parseInt(start),parseInt(length)));
}
/* function jiequ(){
var wenben=document.form1.wenben.value;
if(wenben.length==0){
alert("文本字符串不存在!");
return ;
}
var panduan=document.form1.panduan.value;
if(panduan.length==0){
alert("需要判断的字符串为空");
return ;
}
var start=document.form1.start.value;
var length=document.form1.length.value;
alert(wenben.substring(parseInt(start),parseInt(length)));
}*/
</script>
</head>
<body>
<form name="form1" action="" method="post">
<p>文本:<input type="text" name="wenben" value="hello" /></p>
<hr size="1" width="1"/>
<p><input type="text" name="panduan" value="e1" />
<input type="button" value="判断文本是否存在此内容" onclick="wenben()"/>
</p>
<hr size="1" width="1"/>
<p>起始位置:<input type="text" name="start" value="0"/></p>
<p>截取长度:<input type="text" name="length" value="2"/></p>
<p><input type="button" value="根据指定位置截取文本" onclick="wenben()"/></p>
</form>
</body>
</html>