纯js不要%=i%>这种,你这是什么写法

解决方案 »

  1.   

    <%=i%>是asp滴写法吧,纯js这么写,
    L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
    </head>
    <body>
        <script type="text/javascript">
        <!--
    for(var i=1; i<7; i++) 
    {
        document.write("<H"+i+">Hello</H"+i+">");
    }
        //-->
        </script>
    </body>
    </html>
      

  2.   

    for(i=1;i <6;i++)这里是客户端的
    下面的i是服务器端的~~asp.net示例<script>
    <% for(int i=0;i<6;i++){  %>
    document.write("<h<%=i%>hello</h<%=i%>");
    <%}  %>
    </script>