合作联系微信: w6668263      合作联系电话:177-9238-7426     

动态输出javascript

本页面定义为javascript.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>

<%
    string protype = "var rows=[";
    for (int i = 0; i < 100; i++)
    {
        protype += "{name:'tich_" + i + "',values:'wabt" + i + "iso59-1'}"; if (i < 99) protype += ",";
    } protype += "];";
    Response.Clear();
    Response.ContentType = "text/javascript";
    Response.ContentEncoding = Encoding.UTF8;
    Response.Write(protype);
    Response.End();

%>
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>动态输出javascript内容</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="javascript.aspx">
    </script>

</head>
<body>
    <script type="text/javascript">
        alert(rows.length);
    </script>

    <div id="content">
    </div>
</body>
</html>

posted on 2012-08-23 13:48  龙行龘龘9527  阅读(360)  评论(0编辑  收藏  举报

导航