一、普通WebForm页面

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
<script>
//window.onload = Test;

function Test(id) {

alert(id);
var width = "<%= width %>";
var url = "<% = url %>";

alert(width +" "+url);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div style=" border:solid 1px red" id="123" onclick="var id =$(this).attr('id'); alert(id);Test(id)">
test
</div>
</form>
</body>
</html>

二、带母版页的页面

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
<script>
//window.onload = Test;

function Test(id) {

alert(id);
var width = "<%= width %>";
var url = "<% = url %>";

alert(width + " " + url);
}
</script>

<div style=" border:solid 1px red" id="123" onclick="var id =$(this).attr('id'); alert(id);Test(id)">
test
</div>

</asp:Content>

三、Js调用带参数的C#后台方法

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
<script>
//window.onload = Test;

function Test(id) {

var path = '<%= GetUrl("' + id + '") %>';
alert(path);

var width = "<%= width %>";
var url = "<% = url %>";
alert(width + " " + url);
}
</script>

<div style=" border:solid 1px red" id="123" onclick="var id =$(this).attr('id'); alert(id);Test(id)">
test
</div>

</asp:Content>

Js 访问Aspnet后台页面变量的更多相关文章

  1. JS访问SpringMVC后台

    var actions=ctx.path + "/api/stat/exportScheStatInfo.json"; var form = $("<form> ...

  2. [转]后台页面访问权限:页面基类&内置票据认证 使用方法

    本文转自:http://www.cnblogs.com/fishtreeyu/archive/2011/01/29/1947421.html 一般网站后台页面除了登录页面login.aspx未登录用户 ...

  3. JSF页面中使用js函数回调后台bean方法并获取返回值的方法

    由于primefaces在国内使用的并不是太多,因此,国内对jsf做系统.详细的介绍的资料很少,即使有一些资料,也仅仅是对国外资料的简单翻译或者是仅仅讲表面现象(皮毛而已),它们的语句甚至还是错误的, ...

  4. 在Linux系统中如何设置APACHE服务器里的后台页面只允许某个IP地址访问

    补充资料 本网络中使用LINUX服务器,web服务器是由APACHE搭建,IP地址为192.168.1.5,后台页面为/admin/login.jsp . 如何设置后台页面LOGIN.JSP只允许19 ...

  5. JSF页面中使用js函数回调后台action方法

    最近遇到了一个问题就是在JSF页面中嵌入html页面,这个html页面中很多功能是使用js动态生成的,现在需要在js函数里想去调用JSF中action类method()方法并动态传送数据给后台进行处理 ...

  6. JavaScript获取后台C#变量以及调用后台方法

    http://www.educity.cn/develop/495493.html 有时需要在JavaScript中获取后台变量的值,来判断JavaScript的执行逻辑,或者需要调用C#后台方法获取 ...

  7. js调用.net后台事件,和后台调用前台等方法总结(转帖)

    js调用.net后台事件,和后台调用前台等方法总结 原文来自:http://hi.baidu.com/xiaowei0705/blog/item/4d56163f5e4bf616bba16725.ht ...

  8. chrome 浏览器插件开发(二)—— 通信 获取页面变量 编写chrome插件专用的库

    在chrome插件的开发过程中,我遇到了一些问题,在网上找了不少文章,可能是浏览器升级的原因,有一些是有效的也有无效的.下面我简单的分享一下我遇到的坑,以及我把这些坑的解决方案整理而成的js库 —— ...

  9. DTCMS插件的制作实例电子资源管理(二)Admin后台页面编写

    总目录 插件目录结构(一) Admin后台页面编写(二) 前台模板页编写(三) URL重写(四) 本实例旨在以一个实际的项目中的例子来介绍如何在dtcms中制作插件,本系列文章非入门教程,部分逻辑实现 ...

随机推荐

  1. oracle 树形SQL

    oracle树形sql查询实例分析   通过此SQL语句  [sql] select  * from tree    查看原始数据如下:     我们要想得到如下的一个树形查询结果如下图所示(包含 R ...

  2. java基础-排序

    冒泡排序 选择排序 生成数组,数组元素值为1-1000

  3. C API 连接MYSQL

    #include <iostream> #include <mysql.h> #include <string> #include <assert.h> ...

  4. redis在windows上的安装

    1.下载地址:https://github.com/MSOpenTech/redis 主要支持win64的,有个msi文件可以直接安装,安装后redis会变成一个服务,对于windows来说这种最方便 ...

  5. [ActionScript 3.0] AS3 深入理解Flash的安全沙箱Security Domains

    简介 如果你还没有与复杂的的安全域(security domain)和应用程序域(application domain)问题打过交道,那么你真是个幸运的家伙.当你在加载外部内容(然后他们开始播放)的时 ...

  6. eclipse快捷键使用

    Eclipse的编辑功能非常强大,掌握了Eclipse快捷键功能,能够大大提高开发效率.Eclipse中有如下一些和编辑相关的快捷键.1. [ALT+/]此快捷键为用户编辑的好帮手,能为用户提供内容的 ...

  7. OpenCV数据结构:CvMat,IplImage,CvArr的应用

    最近看HS算法时,发现在新的OpenCV3.0已经移除了该算法,于是不得不看老版的.这其中涉及到了CvMat,CvArr,IplImage的使用.关于这三个结构与Mat的转换关系,总结如下: (1)派 ...

  8. python中报错总结

    python标准异常 异常名称 描述     BaseException 所有异常的基类 SystemExit 解释器请求退出 KeyboardInterrupt 用户中断执行(通常是输入^C) Ex ...

  9. (easy)LeetCode 257.Binary Tree Paths

    Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 ...

  10. cocso2d-x改变精灵图片

    cocos2d-x 改变精灵图片的2种方法. 1. // 首先载入贴图集 CCSpriteBatchNode *spriteBatch=CCSpriteBatchNode::batchNodeWith ...