innerHTMLとinnerText

1726 ワード



<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*,com.abin.db.connection.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
        <title>starting page</title>
  </head>
<script language="javascript" type="text/javascript">
function abin(){
	sp.innerHTML="abin is strong";
}
function abing(){
	sp2.innerHTML="abin is a good boy";
}
function bing(){
	/***innerText   IE??**/
	sp3.innerText="only using for ie";
}

</script>
  <body >
    <div class="nav">
 		<div id="test">
		   <span style="color:red"  id="sp" ></span>
		   <br/>
		   <input type="button"  onclick="abin();" value="click"/>
		</div>
		<div class="nav">
			<span id="sp2" style="color:blue"></span>
			<br/>
			<input type="button" onclick="abing();" value="mouse" />
		</div>
		<div class="" id="ie8">
			<span id="sp3" style="color:green" onclick="bing();"></span>
			<br/>
			<input type="button" onclick="bing();" value="ie"/>
		</div>
    </div>
  </body>
</html>