日期:2014-05-18  浏览次数:20405 次

脚本输出问题
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EasyAJAX._Default" %>

<!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 runat="server">
  <title>Untitled Page</title>
  <script type="text/javascript">
  function s_gethuman()
  {
  alert("你好");
  }
  </script>
</head>
<body>
  <form id="form1" runat="server">
  </form>
</body>
</html>
aspx页面和在cs文件里输出一个段脚本
Page.RegistClientScriptBlock ("d","<script>function s_gethuman(){alert('你好');}</script>")

哪个效率更高,更节省服务器资源。

可是aspx页面也需要服务器解析的,感觉一样啊。求助高人

------解决方案--------------------
类比一下:
你直接用html写这样的话

<htm>
<body>
hello
</body>
</html>



<htm>
<body>
<% response.write("hello") %>
</body>
</html>

你觉得哪个更快一些呢。
------解决方案--------------------
当然直接在aspx里写效率高!省去了服务器解释这个步骤