TextBox8.ClientID这里为空那前台怎么取啊
解决方案 »
- 紧急求助jquery选择器难题???
- 请问document.createElementNS创建的是XML Element还是HTML Element?
- 问个简单的问题,如何用JS改变一个已经打开完毕的网页里的超链接?
- ●●●●●●●●●●●●●●●●●●●●●●●●●●●作者这样写的目的是什么呢????
- 一个棘手的web控件问题
- AJAX调用得到html 连接失效 问题?
- 请问,position中的inherit和static有什么用?
- 大家帮我看看下面的代码,在select 中的onchange事件中问题在哪?
- 大家帮我看看这段javascript的代码是怎么错了,怎么就是不对呢?????
- 关于动态加载层和从server加载数据的问题
- 求一个页面效果
- check为什么会出错(IE)
这样我才能回答清楚你的问题
前台页面=====================================================================
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="ComputerSys.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<script language="javascript">
function setValue( v)
{
document.getElementById( '<%=TextBox1.ClientID %>' ).value = v;
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 280px; POSITION: absolute; TOP: 144px"
runat="server"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 464px; POSITION: absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button><INPUT onchange="setValue(this.value)" style="Z-INDEX: 103; LEFT: 280px; POSITION: absolute; TOP: 208px" type="text">
</form>
</body>
</HTML>后台页面======================================================================using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;namespace ComputerSys
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write( this.TextBox1.Text );
}
}
}
function jisuan()
{
var ele_id="<%=TextBox8.ClientID%>"
if(document.getElementById(ele_id).value)
document.getElementById(ele_id).value="大大大大";
}
</script>
建议加个变量
setValue('1234')取到的值肯定是1234
要知道HTML是解释执行的
你的页面都好没有出来你的TextBox8也就根本不存在