js如何得到一个控件的ID并把ID转换成一个字符串啊?

lc12d 2008-05-08 02:29:22
如题?
...全文
217 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
楼上的答案可以试试
yunfeng007 2008-05-08
  • 打赏
  • 举报
回复
具体怎么得到grid中的textbox,你可以根据此textbox的ClientID来得到
yunfeng007 2008-05-08
  • 打赏
  • 举报
回复
哦。写的时候才知道楼主什么意思

parent.html

<html>
<head>
<script type="text/javascript">
function openWindow()
{
window.open("1.html");
}
function SetTextValue(returnvalue)
{
var text = document.getElementById('text1');
text.value = returnvalue;
}
</script>
</head>
<body>
<form id ="form1" action="">
<input type="textbox" id="text1" name="text1" value=""/>
<input type="button" id ="button1" name="button1name" value="ok" onclick="openWindow();"/>
</form>
</body>
</html>

child.html

<html>
<head>
<script type="text/javascript">
function setOpenerValue()
{
var text = document.getElementById('text1');
window.opener.SetTextValue(text.value);
}
</script>
</head>
<body>
<form id ="form1" action="">
<input type="textbox" id="text1" name="text1" value=""/>
<input type="button" id ="button1" name="button1name" value="ok" onclick="setOpenerValue();"/>
</form>
</body>
</html>
lc12d 2008-05-08
  • 打赏
  • 举报
回复
我说的是datagrid中的textbox
lc12d 2008-05-08
  • 打赏
  • 举报
回复
楼上的谢谢先,好像你的方法用不着
yunfeng007 2008-05-08
  • 打赏
  • 举报
回复
??

<html>
<head>
<script type="text/javascript">
function getContorlId()
{
var objArray = document.getElementsByTagName('input');
for(var obj in objArray)
{
if(objArray[obj].type=="button")
{
var text = document.getElementById('text1');
text.value = objArray[obj].id;
}
}
}
</script>
</head>
<body>
<form id ="form1" action="">
<input type="textbox" id="text1" name="text1" value=""/>
<input type="button" id ="button1" name="button1name" value="ok" onclick="getContorlId();"/>
</form>
</body>
</html>
lc12d 2008-05-08
  • 打赏
  • 举报
回复
一个datagrid中的textbox,现在我想实现单击textbox弹出一个窗口,选择事件,关闭窗口把选的内容传到textbox中,可是在子页面中如何得到返回父页面的控件的ID呢,关键是datagrid,想不出什么方法
周公 2008-05-08
  • 打赏
  • 举报
回复
控件都是固定的,你这种需求没遇到过。
lc12d 2008-05-08
  • 打赏
  • 举报
回复
哪位看了说句话,比较郁闷现在

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧