易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript , ajax

问:
Hi,
I have this C#/ASP.NET/.aspx page with a string variable named myString with the value "Mario Gamito".
How can I access "Mario Gamito" from within a JavaScript function, i. e., the variable's value ?
Already tried '" + mystring + "' but it doesn't works.
Any help would be appreciated.
答1:
<!-- Default2.aspx -->
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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 show()
        {
            var value=document.getElementById("Hidden1").value;
            window.alert(value);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="Hidden1" type="hidden" runat="server"/>
        <input id="Button1" type="button" value="button" onclick="show();"/>
    </div>
    </form>
</body>
</html>
using System;
using System.Collections;
//Default2.aspx.cs
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web


相关文档:

javaScript验证提交

javaScript验证提交
看例:
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT=""&g ......

JavaScript获取计算机MAC等硬件信息

(1)下载ClientInfo.dll(在我的资源中可以下载http://download.csdn.net/source/2141582)
(2)使用new ActiveXObject("ClientInfo.HostInfo")调用ActiveX库
(3)GetAdapterMac(0)获取网卡MAC地址
使用示例:
<HTML>
<TITLE>ClientInfoX JavaScript Sample</TITLE>
<HEAD>
<script l ......

JavaScript导出word excel文件

出处:http://www.jcwcn.com/article/2005/1210/javascript_17476.html
<HTML>
  <HEAD>
    <title>WEB页面导出为EXCEL文档的方法
    </title>
  </HEAD>
<body>
<BR>
<table id = "PrintA" width="100%" border="1" cell ......

Javascript中最常用的61个经典技巧

 1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut= ......

JavaScript实现水平选项卡效果

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号