日期:2014-05-17 浏览次数:20456 次
<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="False" EnableViewState="False" EnableViewStateMac="False"
Title="jQuery Rater Plugin Demo Test Handler" %>
<script runat="server">
public void Page_Load(object sender, EventArgs e)
{
const float RATING = 7;
const float COUNT = 2;
Response.ContentType = "text/plain";
try
{
if (Request.QueryString["error"] == "true")
throw new Exception("Error rating entry! This is a simulated error message created at the server.");
float rating = RATING + float.Parse(Request.Form["rating"]);
float result = rating / (COUNT + 1);
Response.Write(result.ToString("0.0"));
}
catch (Exception ex)
{
Response.StatusCode = 202;
Response.Write(ex.Message);
Response.Flush();
Response.End();
}
}
</script>
<%也不知道记得对不对
DIM RATING0,COUNT0,rating,result
RATING0 = 7
COUNT0 = 2
Response.ContentType = "text/plain";
If (Request.QueryString("error") = "true") Then
Response.Status = 202
Response.Write("Error rating entry! This is a simulated error message created at the server.")
Response.Flush()
Response.End()
Else
rating = RATING0 + CSng(Request.Form("rating"))
result = rating / (COUNT0 + 1);
Response.Write(result)
End If
%>
<html>
<head>
<title>jQuery Rater Plugin Demo Test Handler</title>
</head>