可以运行了,lz 自行比对吧!<html>
<head>
<title>为什么这段代码运行不了?</title>
</head>
<body>
<script text="text/javascript" language="javascript">
var x, y;
x=1;
    document.write('x=1');
    document.write('<br>');
if (x==1)
    document.write('x是等于1');
else
    document.write('x是不等于1');
document.write('<br>');switch(x)
{
    case 0:
        document.write('x是等于0');
        break;
    case 1:
        document.write('x是等于1');
        break;
   default:document.write('x不等于0或1');
}
</script>
</body>
</html>

解决方案 »

  1.   

    <html>
    <head>
    <title>为什么这段代码运行不了?</title>
    </head>
    <body>
    <script text="text/javascript" language="javascript">
    var x,y;
    x=1;
        document.write('x=1');
        document.write('<br>');
    if (x==1)
        document.write('x是等于1');
    else
        document.write('x是不等于1');
    document.write('<br>');switch(x)
    {
       case 0: document.write('x是等于0');
                   break;
       case 1: document.write('x是等于1');
                   break;
       default: document.write('x不等于0或1');
    }
    </script>
    </body>
    </html>