后台获取javascript 变量的值 <script type="text/javascript"> var arrayObj=new Array(0,1,0,0,6,0,0,0); /script>我如何在后台获取 数量arrayObj的值啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 放到VIEWSTATE,HIdden,等东西里都可以了. asp.net前台页面 //如果想要修改div效果,请参照我空间的另一篇文章"css+div基础必备"<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %><!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>简单的实现,但是可以举一反三</title> <style type="text/css">//层位置#sponsorAdDiv {position:fixed ; height:1; width:1; top:0; left:0; }</style><SCRIPT language="javascript" type="text/javascript">adTime=6; //关闭窗口等待的时间chanceAd=1;var ns=(document.layers);var ie=(document.all);var w3=(document.getElementById && !ie);adCount=0;//初始加载层function initAd(){ if(!ns && !ie && !w3) return; if(ie) adDiv=eval('document.all.sponsorAdDiv.style'); else if(ns) adDiv=eval('document.layers["sponsorAdDiv"]'); else if(w3) adDiv=eval('document.getElementById("sponsorAdDiv").style'); randAd=Math.ceil(Math.random()*chanceAd); if (ie||w3) adDiv.visibility="visible"; else adDiv.visibility ="show"; if(randAd==1) showAd();}//自动关闭层//-------------------------------------------------------------------------------------------function showAd(){if(adCount<adTime*10){adCount+=1; if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20; documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;} else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20; documentHeight=window.innerHeight/2+window.pageYOffset-20;} else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20; documentHeight=self.innerHeight/2+window.pageYOffset-20;} adDiv.left=documentWidth-200;adDiv.top =documentHeight-200; setTimeout("showAd()",100);}else closeAd();}function closeAd(){if (ie||w3)adDiv.display="none";elseadDiv.visibility ="hide";}//----------------------------------------------------------------------------------------------</SCRIPT></head><body> <form id="form1" runat="server"> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /><div id="sponsorAdDiv" align="center" style="visibility:hidden"></br></br></br><table width="450" height="250px" bgcolor="008000" align="center"> <tr> <td> <table width="440" bgcolor="F0FFF0" style="height: 240px"> <tr> <td><asp:Label ID="Label1" runat="server"></asp:Label> <center style="height: 92px"><BR><BR>这个窗口将在5秒后自动关闭 </center> </td> </tr> <Tr> <td align="right"><asp:LinkButton ID="LinkButton1" runat="server" Text="关闭" onclick="LinkButton1_Click"></asp:LinkButton></td> </tr> </table> </td> </tr></table></div> </form></body></html>…………………………………………………………………………………………………………………………后台调用…………………………………………………………………………………………………………………………using System;using System.Collections;using System.Configuration;using System.Data;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;public partial class test : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.Label1.Text = "您的得分为60分"; } } protected void LinkButton1_Click(object sender, EventArgs e) { Response.Redirect("default.aspx"); } protected void Button1_Click(object sender, EventArgs e) { Page.RegisterStartupScript("", "<script>onload=initAd;</script>"); }} 后台只能取到字符串array转字符串 既能没法直接获取, post /get 后台 传到前台javascript呢,请会的写段代码给参考一下。 C# 中 as的作用 这个VS2008究竟是哪个版本? 各位大虾:能提供一个功能比较齐全的学生管理系统的源代码么?(标准三层架构) C# 使用 OWC 如何设置字体 DotNetBar 工具欄使用問題 XP 托盘:程序退出后图标的“尸体”还留在托盘中,用鼠标“经过”一下,就没了,怎么能让它在程序退出时就自动消失? C#中如何禁止系统的热键? 静态方法有那么好么 有谁知道dotfucsator的注册码? 请教正则表达式[\w-] 表示什么意思? MVC 页面验证 ViewData导致无法验证 数据库查询语句
<head runat="server">
<title>简单的实现,但是可以举一反三</title>
<style type="text/css">//层位置
#sponsorAdDiv {position:fixed ; height:1; width:1; top:0; left:0; }
</style>
<SCRIPT language="javascript" type="text/javascript">
adTime=6; //关闭窗口等待的时间chanceAd=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
adCount=0;//初始加载层
function initAd(){
if(!ns && !ie && !w3) return;
if(ie) adDiv=eval('document.all.sponsorAdDiv.style');
else if(ns) adDiv=eval('document.layers["sponsorAdDiv"]');
else if(w3) adDiv=eval('document.getElementById("sponsorAdDiv").style');
randAd=Math.ceil(Math.random()*chanceAd);
if (ie||w3)
adDiv.visibility="visible";
else
adDiv.visibility ="show";
if(randAd==1) showAd();
}
//自动关闭层
//-------------------------------------------------------------------------------------------
function showAd(){
if(adCount<adTime*10){adCount+=1;
if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20;
documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
documentHeight=window.innerHeight/2+window.pageYOffset-20;}
else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
documentHeight=self.innerHeight/2+window.pageYOffset-20;}
adDiv.left=documentWidth-200;adDiv.top =documentHeight-200;
setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
//----------------------------------------------------------------------------------------------</SCRIPT>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<div id="sponsorAdDiv" align="center" style="visibility:hidden">
</br></br></br><table width="450" height="250px" bgcolor="008000" align="center">
<tr>
<td>
<table width="440" bgcolor="F0FFF0" style="height: 240px">
<tr>
<td><asp:Label ID="Label1" runat="server"></asp:Label>
<center style="height: 92px"><BR><BR>这个窗口将在5秒后自动关闭
</center>
</td>
</tr>
<Tr>
<td align="right"><asp:LinkButton ID="LinkButton1" runat="server" Text="关闭"
onclick="LinkButton1_Click"></asp:LinkButton></td>
</tr>
</table>
</td>
</tr></table></div>
</form>
</body>
</html>…………………………………………………………………………………………………………………………后台调用…………………………………………………………………………………………………………………………using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.Label1.Text = "您的得分为60分";
}
} protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("default.aspx");
} protected void Button1_Click(object sender, EventArgs e)
{
Page.RegisterStartupScript("", "<script>onload=initAd;</script>");
}
}
array转字符串