<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="button" name="btn" id="btn" value="点击按钮" />
<div id="div3">
哈喽
</div>
</body>
<script src="common.js">
</script>
<script type="text/javascript">
function setInnerText(element,text){
if(typeof element.innerText==undefined){
element.textContent=text;
}
else{
element.innerText=text;
}
}
function getInnerText(element){
if(element.innerText==undefined){
return element.textContent;}
else {return element.innerText;}
}
my$("btn").onclick=function(){
console.log(getInnerText(my$("div3")));
}
</script>
</html>