<script type="text/javascript">
    var tt =confirm("要选择歌曲吗?");
       if (tt==true)
        {
          location.href ="music.html";
        }
       else
        {
          location.href ="index.html";
         }
</script>
if里面绝对有问题,不知道怎么修改 请各位帮忙解决 给分!!

解决方案 »

  1.   

    <script type="text/javascript"> 
        
          if (confirm("要选择歌曲吗?")) 
            { 
              location.href ="music.html"; 
            } 
          else 
            { 
              location.href ="index.html"; 
            } 
    </script> 
      

  2.   

    <script type="text/javascript"> 
        var tt =confirm("要选择歌曲吗?"); 
          if (tt) 
            { 
              location.href ="music.html"; 
            } 
          else 
            { 
              location.href ="index.html"; 
            } 
    </script>