2012-04-12 12 views
0

私は本当にこれを取得しないでください。 JavaScriptの例でCSSを使って3つのボタンを隠そうとしましたが、何も起こりませんでした!なぜli.twoとli.threeは隠れませんか?私は彼らのボタンがクリックされるまでli.twoとli.threeが表示されないようにしたいです。 、あなたがあなたのCSSが間違っている<li>なぜ私のボタンは隠れませんか? (JavaScript関数/ CSSの可視性)

<li class="one"><input type="button" onclick="show_prompt();showNext('Yahoo')" value="Google" /></li> 
<li class="two"><input type="button" id="Yahoo" onclick="show_alert();showNext('Facebook')" value="Yahoo" /></li> 
<li class="three"><input type="button" id="Facebook" onclick="show_alert1()"value="Facebook" /></li> 

には終了タグを持たない

<html> 
<head> 
<script type="text/javascript"> 
function show_prompt() 
{ 
var name=prompt("Your Name"); 
if (name!=null && name!="") 
    { 
    alert("Thanks for clicking " + name + "!"); 
    window.open("http://www.google.com/}; 
} 
</script> 
<script type="text/javascript"> 
function show_alert() 
{ 
alert("Thanks for clicking me!"); 
window.open("http://www.yahoo.com/"); 
} 
</script> 
<script type="text/javascript"> 
function show_alert1() 
{ 
alert("Have fun on Facebook!"); 
window.open("http://www.facebook.com/"); 
} 
</script> 
<script type="css/text"> 
li.two, li.three {display:none}; 
</script> 
</head> 
<body> 
<ul> 
<li class="one"><input type="button" onclick="show_prompt();showNext('Yahoo')" value="Google" /> 
<li class="two"><input type="button" id="Yahoo" onclick="show_alert();showNext('Facebook')" value="Yahoo" /> 
<li class="three"><input type="button" id="Facebook" onclick="show_alert1()"value="Facebook" /> 
</ul> 
</body> 
</html> 
+0

を試してみてください自身の '

1

あなたは李タグのみごshowNext()関数呼び出しに閉じていないこの

<li class="one"><input type="button" onclick="show_prompt();showNext('Yahoo')" value="Google" /> 
<li class="two"><input type="hidden" type="button" id="Yahoo" onclick="show_alert();showNext('Facebook')" value="Yahoo" /> 
<li class="three"><input type="hidden" type="button" id="Facebook" onclick="show_alert1()"value="Facebook" /> 
0

を使用する必要があり、その機能を書いていません

あなたはその中の各機能を持っていないのはなぜこの

 <html> 
     <head> 
     <style type="text/css"> 
     .two,.three{ 
     display:none; 
     } 
     </style> 


     <script type="text/javascript"> 
     function show_prompt() 
     { 
     var name=prompt("Your Name"); 
     if (name!=null && name!="") 
      { 
      alert("Thanks for clicking " + name + "!"); 
      window.open("http://www.google.com/") 

      }; 
     } 
     </script> 
     <script type="text/javascript"> 
     function showNext(value){ 

     document.getElementById(value).style.display="block"; 





     } 
     </script> 
     <script type="text/javascript"> 
     function show_alert() 
     { 
     alert("Thanks for clicking me!"); 
     window.open("http://www.yahoo.com/"); 
     } 
     </script> 
     <script type="text/javascript"> 
     function show_alert1() 
     { 
     alert("Have fun on Facebook!"); 
     window.open("http://www.facebook.com/"); 
     } 
     </script> 

     </head> 
     <body> 
     <ul> 
     <li class="one"><input type="button" onclick="show_prompt();showNext('Yahoo')" value="Google" /></li> 
     <li class="two" id="Yahoo" ><input type="button" id="Yahoo" onclick="show_alert();showNext('Facebook')" value="Yahoo" /></li> 
     <li class="three" id="Facebook"><input type="button" id="Facebook" onclick="show_alert1()"value="Facebook" /></li> 
     </ul> 
     </body> 
     </html> 
関連する問題