//文本框
<asp:TextBox ID="chanpin1" runat="server" CssClass="tfont" ReadOnly="True" Width="80px">请选择产品</asp:TextBox>
<asp:HiddenField ID="chanpin1_HiddenField" runat="server" />
<asp:TextBox ID="scj1" runat="server" CssClass="tfont" Width="82px"></asp:TextBox>元
<asp:HiddenField ID="scj1_HiddenField" runat="server" />
//图片按钮
<img id="Img1" border="0" height="20" οnclick="return OpenPWin('chanpin1','scj1');" src="img/add.gif" width="62" />
//获取单选行
function weiyi(id) //选择唯一
{
var obj = document.getElementById(id);
if(obj.checked)
{
obj.checked = true;
var gr = document.getElementById('GridView1');
for(i=0;i<gr.rows.length;i++)
{
var cb = gr.rows[i].cells[0].children[0];
if(cb.id != obj.id)
{
cb.checked = false;
}
}
}
else
{
obj.checked = false;
}
}
<%--获取传来的变量--%>
<script defer>
var k = window.dialogArguments; //获取父类所有信息
var type = k.document.getElementById("type_HiddenField").value; //获取父类的type_HinddenFieid值
var type1=k.document.getElementById("type1_HiddenField").value;
var t = k.document.getElementById(type);
var t1 = k.document.getElementById(type1);
var kjian = k.document.getElementById(type+'_HiddenField'); //产品名称
var kjian1 = k.document.getElementById(type1+'_HiddenField');//产品价格
function huoqu()
{
var datalist = document.getElementById("GridView1");
var pinpai="";
var name = "";
var price="";
for( i=0;i<datalist.rows.length;i++)
{
var cb = datalist.rows[i].cells[0].children[0];
if(cb.checked)
{
pinpai = datalist.rows[i].cells[1].innerText; //品牌
name = datalist.rows[i].cells[2].innerText; //名称
price = datalist.rows[i].cells[3].innerText; //市场价
}
}
t.value = pinpai + "-" + name;
kjian.value = pinpai + "-" + name;
t1.value = price;
kjian1.value = price;
window.close();
// alert(type + ","+type1+","+price);
}
</script>
//提交
<input type=button value="提交" class="tfont" οnclick="huoqu()" />
<input type=button value="取消" class="tfont" οnclick="window.close()" />
//js脚本类
//窗口产品选择
function OpenPWin(name,scj)
{
var hf = document.getElementById('type_HiddenField');
hf.value = name;
var hf1= document.getElementById('type1_HiddenField');
hf1.value = scj;
var str=window.showModelessDialog('bargain_class.aspx',window,'dialogWidth=530px;dialogHeight=555px;status=no;help=no;scrollbars=no;')
return false;
}