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ÌØÐ§´óÈ«£¬°üº¬È«²¿Ô´´úÂëºÍÏêϸ´úÂë˵Ã÷£¬²»¿É¶àµÃ
JavaScriptʵÏÖ¿ÉÒÔÍêÈ«×ÔÓÉÍÏ×§µÄЧ¹û£¬´øÈý¸ö·¶Àý http://www.sharejs.com/showdetail-501.aspx
javascriptʵÏÖ¿ÉÒÔ×ÔÓÉÍ϶¯µÄÊ÷ÐÎÁбí http://www.sharejs.com/showdetail-500.aspx  ......
1
¡¢Àí½âdocument.all
[]
¡¡¡¡´ÓIE4¿ªÊ¼IEµÄobject
model²ÅÔö¼ÓÁËdocument.all
[],À´¿´¿´document.all
[]µÄDescription:
Array
of all HTML tags in the document.Collection of all elements contained by the
object.
¡¡¡¡Ò²¾ÍÊÇ˵document.all
[]ÊÇÎĵµÖÐËùÓбêÇ©×é³ÉµÄÒ»¸öÊý×é±äÁ¿£¬°üÀ¨ÁËÎĵµ¶ÔÏóÖÐËùÓ ......
function get_cookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0)
{
var offset = document.cookie.indexOf(search)
if (offset != -1)
{
&nbs ......
javascriptÉè¼ÆÄ£Ê½µÚÒ»ÕÅÓÐÒ»¸öÓÐȤµÄʵÏּ̳еķ½·¨£¬µ±È»javascript±¾ÖÊÉÏÊÇʵÏּ̳У¬»¹²»ÊǵäÐÍÒâÒåÉϵÄ"is-a"µÄÂß¼¼Ì³Ð»òÕß˵ÊÇÓïÒå¼Ì³Ð¡£»ù±¾µÄ·½·¨¾ÍÊÇͨ¹ýfunctionµÄprototypeÊôÐÔ¡£
Ò»£¬ºÜ¼òµ¥µÄ·½·¨
<script type="text/javascript">
<!--
var Anim = function(){ ......
// ´óѧÀï×îÍ´¿àµÄÊÂÇéιýÓÚ×ö±ÏÒµÉè¼Æ£¬Ä¿Ç°Õý´¦ÓÚÕâ¸öʱÆÚ¡£
// £º£¨ :(
//
// Ê×ÏȼǼϵÄÊÇ Function µÄÒ»¸öÎÊÌâ
Function.prototype.method = function( name, func){
if( ! this.prototype[ name]){
this.prototype[ name ] = func;
}
} // ¸ø º¯ÊýÔÐÍÔö¼Ó·½·¨
//
// ¸øº¯ÊýÔÐÍÔö¼ÓµÄ·½·¨ÔÚ St ......