為什么不能隱藏呢?
? <p id="addedtext">because they are too near</p>
? ? ? ? ? ?<input type="button" ?onclick="showtext()" value="showtext" style="float: none;" />
? ? ? ? ? ? ? <input type="button" ?onclick="hidetext()" value="hidetext" style="float:none;"/>
<script type="text/javascript">
? ? ? ? ? ? ?var mynear=document.getElementById("addedtext");
? ? ? ? ? function showtext(){
? ? ? ? ? ? ? ? mynear.style.display=block;
? ? ? ? ? }
? ? ? ? ? function hidetext(){
? ? ? ? ? ? ? ?mynear.style.display=none;
? ? ? ? ? }
為什么隱藏沒(méi)有反應(yīng)呢?
2017-07-13
display的兩個(gè)屬性值要加引號(hào)。
2017-07-12
?<p id="addedtext">because they are too near</p>
? ? ? ? ? ?<input type="button" ?onclick="showtext()" value="showtext" style="float: none;" />
? ? ? ? ? ? ? <input type="button" ?onclick="hidetext()" value="hidetext" style="float:none;"/>
<script type="text/javascript">
? ? ? ? ? ? ?var mynear=document.getElementById("addedtext");
? ? ? ? ? function showtext(){
? ? ? ? ? ? ? ? mynear.style.display="block";//加引號(hào)大兄弟
? ? ? ? ? }
? ? ? ? ? function hidetext(){
? ? ? ? ? ? ? ?mynear.style.display="none";//加引號(hào)大兄弟
? ? ? ? ? }
</script>
小問(wèn)題以后多注意。
2017-07-12
變量放在函數(shù)里邊