简单问题,关于web控件dropdownlist!在线等急! 我的web页面有个dropdownlist,我想把dropdownlist所选的值取出来,给javascript中的一个变量,不知道怎么才能给这个变量,急死了!希望大家帮忙! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DropDownList.SelectedItem.Value 属性 你得用一个事件触发这个函数。如:Button string svalue=DropDownList.SelectedItem.Value;string strscript="<javascript>function getsvalue(){return "+svalue+";}</javascript>"Page.RegisterStartupScript("setvalue",strscript); var p1 = document.all.list_ID.value;list_ID是DropDownList的ID string s = "";foreach(ListItem li in DropDownList1.Items){ s += li.Text;}js中直接调用这个服务器变量<%=s%> 再问您一下,如果我要取web控件textBox中的值给javascript的变量呢!还有就怎么把javascript中的值给textBox文本! function al(val){var i=val;} string val=DropDownList.SelectedItem.Value;string script="<javascript>al(" + val + ")</javascript>"Page.RegisterStartupScript("setvalue",script); dropdownlist:是服务器控件javascript的变量在前台,如何交互啊!!除非在页面事件触发后(页面提交),将其值给到一个前台隐藏的html控件 ,然后javascript的变量=这个html控件的值 javascript------------------------------------------------------------------------- for(i=1;i<document.all("dropdownlist").length;i++) { if(document.all("dropdownlist").options[i].value == document.all("dropdownlist").value) document.all("tt").value = document.all("ddl").options[i].text; }tt为客户端控件 要是取值就改成这个document.all("tt").value = document.all("ddl").options[i].value; 要是取值就改成这个document.all("tt").value = document.all("ddl").options[i].value; fckeditor怎么用~~~ waitcallback()可以理解为 新建了一个线程么? c#里怎么取得active directory里的帐户密码? 怎么验证用户名是否存在呢? 关于弹出窗口的问题 谢谢大家 50分相送 难题:关于Img src页和Image所在页面的执行顺序 [馨郁星愿]急~!~~~关于Url的问题 缓存的问题 哪位大侠做过动态生成组织结构图的例子, 请教一个用datatable汇总的问题 奇怪的session不见了的问题..大家快来看看. 一个菜鸟问题,在线等待,各位大哥帮忙啊!!
string strscript="<javascript>function getsvalue(){return "+svalue+";}</javascript>"
Page.RegisterStartupScript("setvalue",strscript);
foreach(ListItem li in DropDownList1.Items)
{
s += li.Text;
}js中直接调用这个服务器变量
<%=s%>
var i=val;
}
string val=DropDownList.SelectedItem.Value;
string script="<javascript>al(" + val + ")</javascript>"
Page.RegisterStartupScript("setvalue",script);
javascript的变量在前台,如何交互啊!!除非在页面事件触发后(页面提交),将其值给到一个前台隐藏的html控件 ,然后javascript的变量=这个html控件的值
-------------------------------------------------------------------------
for(i=1;i<document.all("dropdownlist").length;i++)
{
if(document.all("dropdownlist").options[i].value == document.all("dropdownlist").value)
document.all("tt").value = document.all("ddl").options[i].text;
}tt为客户端控件
document.all("tt").value = document.all("ddl").options[i].value;
document.all("tt").value = document.all("ddl").options[i].value;