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
相关文档:
--------------------------------------------------------------------------------
<body>
<mce:script type="text/javascript"><!--
document.write("如果显示了这段文字,那么您的浏览器支持 JavaScript!")
// --></mce:script>
<noscript>No JavaScript support!</noscript&g ......
400多个JavaScript特效大全,包含全部源代码和详细代码说明,不可多得
JavaScript实现可以完全自由拖拽的效果,带三个范例 http://www.sharejs.com/showdetail-501.aspx
javascript实现可以自由拖动的树形列表 http://www.sharejs.com/showdetail-500.aspx  ......
1.delete 运算符
对象删除一个属性,或数组中删除一个元素。将无用的内容删除以节省空间。
delete expression
example:
var person = new Object();
person.sex = "male";
alert(person.sex);
delete person.sex;
alert(person.sex);
2. ‘,' 运算符
var a = 2;
......
javascript的系统函数
1,encodeURI方法
返回对一个URI字符串编码中的结果,本质是UTF-8编码
eg:
var urlStr = encodeURI('http://fanli.qq.com/index.html?a=ddd&msg=中国');
alert(urlStr);
2, decodeUR ......
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= ......