<h1><script>alert(i)</script></h1>

解决方案 »

  1.   

    javascript没又 int i=0这种写法;改成var i=0;
    <Script>
    var i=0;
    </Script>
    <body>
    <h1 id=sh><script>sh.innerHTML=i;</script></h1>
    </body>
      

  2.   

    <h1 id=sh><script>document.write(i);</script></h1>
      

  3.   

    <Script>
    var i=0;
    </Script>
    <body>
    <h1 id=sh><script>sh.innerHTML=i;</script></h1>
    </body>
      

  4.   

    如果以上的都不可以,那么就是顺序问题,如下的绝对可以,测试过了!
    <body>
    <h1 id="test">这里引用上面的i,因该如何写!</h1>
    <Script>
    {
    var i=0;
    document.all.test.innerHTML=i;//这个地方要寻找test的
    }
    </Script>
    </body>
      

  5.   

    有没有直接<=i>这种方法呢?
      

  6.   

    怎么可能不行啊。。无语。。
    <Script>
    int i=0;
    </Script>
    <body>
    <h1 id=sh><script>document.write(i);</script></h1>
    </body>
      

  7.   


    <Script>
    var i=0;
    </Script>
    <body>
    <h1 id=sh><script>document.write(i);</script></h1>
    </body>
      

  8.   

    我的意思是<table bg=<script>document.write("red")</script>>
    </table>这样不行,有什么办法没?
      

  9.   


    <script>
     document.getElementById('aa').bgColor='red' ;
    </script>
    <table id="aa">
    </table>
      

  10.   

    楼主要好好补一下下javascript和html的基本功啊。
      

  11.   

    不行啊,必须是
    <table bg=<script>document.write("red")</script>>
    </table>
      

  12.   

    <script>
    var color ="red" ;
    document.write("<table bg="+color+"></table>")
    </script>最后一次回这个帖!!无语中
      

  13.   

    <Script>
    var i=0;
    </Script>
    <body>
    <h1 id=sh><script>sh.innerHTML=i;</script></h1>
    </body> 这个怎么可能会不行呢?
    你用的是不是int 呀,在javascript 中用的可是var