<script language="javascript">
function test1(){
var con=content.innerText;
window.alert(con);}
</script>
</head>
<body>
<textarea rows="20" cols="20">
</textarea>
<input name="mytest" type="button" onclick="test1()" value="测试"/>
</body>
</html>错误:var con=content.innerText;
求解答,谢谢!
function test1(){
var con=content.innerText;
window.alert(con);}
</script>
</head>
<body>
<textarea rows="20" cols="20">
</textarea>
<input name="mytest" type="button" onclick="test1()" value="测试"/>
</body>
</html>错误:var con=content.innerText;
求解答,谢谢!
<script language="javascript">
function test1(){
var con=document.getElementById("mytest");
window.alert(con);
}
</script>
</head>
<body>
<textarea rows="20" cols="20">
</textarea>
<input id="mytest" name="mytest" type="button" onclick="test1()" value="测试"/>
</body>
</html>
应该这样写吧..
<textarea id="mytest" rows="20" cols="20"> </textarea>id放错位置了
<html>
<head>
<title>test53.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script language="javascript">
function test1(){
var con=document.getElementById("mytest").innerText;window.alert(con); }
</script>
</head>
<body>
<textarea rows="20" cols="20" id="mytest">
</textarea >
<input type="button" onclick="test1()" value="测试"/>
</body>
</html>