我有一个信息列表,希望点击其中任何一个“查看”链接,弹出一个只有关闭按钮的iframe窗口,
这个iframe窗口的地址中有一个ID参数,是根据链接中href的值变动的,现在的问题就是怎么获取到这个ID值?
还要把那个#号过滤掉。
红色部分是就是ID值<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Window Example</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" /> <!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS --> <script type="text/javascript" src="ext/ext-all.js"></script> <script language="javascript">
Ext.onReady(function(){
var win;
var button = Ext.get('show-Customer'); button.on('click', function(){
// create the window on the first click and reuse on subsequent clicks
if(!win){
win = new Ext.Window({
//id: 'tong-win',
title:'客户详细信息',
width:560,
height:480,
iconCls:'icon-grid',
closeAction:'hide',
shim:false,
animCollapse:false,
constrainHeader:true,
html : '<iframe src="xxx.aspx?ID=ID值&rnd='+Math.random()+'" frameborder=0 width=100% height=100%></iframe>',
buttons: [{
text: '关 闭',
handler: function(){
win.hide();
}
}]
});
}
win.show(this);
});
});
</script>
</head>
<body>
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>ID</td>
<td>姓名</td>
<td>操作</td>
</tr>
<tr>
<td>3</td>
<td>张三</td>
<td><a href="#3" class="ShowCustomer">查看</a></td>
</tr>
<tr>
<td>5</td>
<td>李四</td>
<td><a href="#5" class="ShowCustomer">查看</a></td>
</tr>
<tr>
<td>6</td>
<td>王五</td>
<td><a href="#6" class="ShowCustomer">查看</a></td>
</tr>
</table>
</body>
</html>
这个iframe窗口的地址中有一个ID参数,是根据链接中href的值变动的,现在的问题就是怎么获取到这个ID值?
还要把那个#号过滤掉。
红色部分是就是ID值<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Window Example</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" /> <!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS --> <script type="text/javascript" src="ext/ext-all.js"></script> <script language="javascript">
Ext.onReady(function(){
var win;
var button = Ext.get('show-Customer'); button.on('click', function(){
// create the window on the first click and reuse on subsequent clicks
if(!win){
win = new Ext.Window({
//id: 'tong-win',
title:'客户详细信息',
width:560,
height:480,
iconCls:'icon-grid',
closeAction:'hide',
shim:false,
animCollapse:false,
constrainHeader:true,
html : '<iframe src="xxx.aspx?ID=ID值&rnd='+Math.random()+'" frameborder=0 width=100% height=100%></iframe>',
buttons: [{
text: '关 闭',
handler: function(){
win.hide();
}
}]
});
}
win.show(this);
});
});
</script>
</head>
<body>
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>ID</td>
<td>姓名</td>
<td>操作</td>
</tr>
<tr>
<td>3</td>
<td>张三</td>
<td><a href="#3" class="ShowCustomer">查看</a></td>
</tr>
<tr>
<td>5</td>
<td>李四</td>
<td><a href="#5" class="ShowCustomer">查看</a></td>
</tr>
<tr>
<td>6</td>
<td>王五</td>
<td><a href="#6" class="ShowCustomer">查看</a></td>
</tr>
</table>
</body>
</html>
-->button.on('click', function(e){handler: function(){--> e.target // ==> $(#id)
win.hide();
}
在事件方法里可以取到href的值过滤掉‘#’
然后打开窗口
不知道这样可不可以
不过我想问LZ为什么不用按钮啊
感觉用按钮的话会比用<a>标签方便啊
查看 | 编辑 | 删除后面的都是<a>标签,我总不行让一个是按钮吧
操作GRID的选择模型就可以了,传参只是形式
var grid = Ext.getCmp("grid"); //取父窗体parent.Ext.getCmp("grid");
var store = grid.getStore();
var zgmodel = grid.getSelectionModel();
var zgselect = zgmodel.getSelections();
var ID= zgselect[0].data.ID; //这个ID是GRID里的列,随便那一列都可以的,