易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

400多个JavaScript特效大全

400多个JavaScript特效大全,包含全部源代码和详细代码说明,不可多得
JavaScript实现可以完全自由拖拽的效果,带三个范例     http://www.sharejs.com/showdetail-501.aspx 
javascript实现可以自由拖动的树形列表     http://www.sharejs.com/showdetail-500.aspx  ......

javascript的系统函数

javascript的系统函数
1,encodeURI方法
     返回对一个URI字符串编码中的结果,本质是UTF-8编码
     eg:
     var urlStr = encodeURI('http://fanli.qq.com/index.html?a=ddd&msg=中国');
     alert(urlStr);
2, decodeUR ......

javascript 正则表达式 去除空格

! 去除字符串两端空格的处理
  如果采用传统的方式,就要可能就要采用下面的方式了
  //清除左边空格
  function js_ltrim(deststr)
  {
  if(deststr==null)return "";
  var pos=0;
  var retStr=new String(deststr);
  if (retStr.lenght==0) return retStr;
  while (retStr.substring(pos, ......

javascript技术技巧大全

//各种尺寸
s  +=  "\r\n网页可见区域宽:"+  document.body.clientWidth;  
s  +=  "\r\n网页可见区域高:"+  document.body.clientHeight;  
s  +=  "\r\n网页可见区域高:"+  document.body.offs ......

JavaScript 笔记 myhere

// 大学里最痛苦的事情莫过于做毕业设计,目前正处于这个时期。
// :( :(
//
// 首先记录下的是 Function 的一个问题
Function.prototype.method = function( name, func){
if( ! this.prototype[ name]){
this.prototype[ name ] = func;
}
} // 给 函数原型增加方法
//
// 给函数原型增加的方法在 St ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号