-
-
nannan 数据老手Lv5
发表于2020-5-27 10:44
悬赏1
未解决
楼主
酷屏的点击事件里面能不能设置点击后在当前窗口打开新链接而不是打开一个新窗口? 具体的代码这边应该怎么改呀?下面这个是打开新窗口的代码
/**
* @param target,点击的标题(li标签)
* @param index,点击的标题所在的位置
*/
function eventFunc(target,index) {
if(index==0){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$f7e4c8e977454275a02edfcf06a51d0c&calcnow=true&encode=true")
}else if(index==1){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&calcnow=true&encode=true")
} else if(index==2){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$a344fd7a6bd349cfbcc3806d5ecbdf21&calcnow=true&encode=true")
} else if(index==3){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$d384ef3c220f464b9df2bc1a8452fba9&calcnow=true&encode=true")
} else if(index==4){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$04ae587156724ed8b91c014505f68602&calcnow=true&encode=true")
} else{
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2b02cfe5c7be46d3a45ed85a006f89f8&calcnow=true&encode=true")
}
console.log("您点击的是"+target.textContent);
}
/**
* @param target,点击的标题(li标签)
* @param index,点击的标题所在的位置
*/
function eventFunc(target,index) {
if(index==0){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$f7e4c8e977454275a02edfcf06a51d0c&calcnow=true&encode=true")
}else if(index==1){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&calcnow=true&encode=true")
} else if(index==2){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$a344fd7a6bd349cfbcc3806d5ecbdf21&calcnow=true&encode=true")
} else if(index==3){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$d384ef3c220f464b9df2bc1a8452fba9&calcnow=true&encode=true")
} else if(index==4){
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$04ae587156724ed8b91c014505f68602&calcnow=true&encode=true")
} else{
window.open( EUI.getContextPath()+ "ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2b02cfe5c7be46d3a45ed85a006f89f8&calcnow=true&encode=true")
}
console.log("您点击的是"+target.textContent);
}
10个回答
本帖最后由 前端小姐姐 于 2020-5-27 11:13 编辑
nannan 发表于 2020-5-27 10:55
具体应该咋写呀cry.gif
function clickNav(index){
var dom = EUI.isNumber(index)?lisArr[index]:index;
var url = dom.getAttribute("url");
mainframe.src = url?url:"../resource/EANA$2$4$1$3952038108be43889f8a1d5e5dcc8eda$c8f826c54b0445f094ffcac0706ca7a1";
}
你可以参考下 根据你的实际情况改改
前端小姐姐 发表于 2020-5-27 11:12
var mainframe = document.getElementById("main-iframe");
function clickNav(index){
var dom = ...
如果用这个脚本的话我这边是不是组件里面的HTML代码要加一个iframe?
function eventFunc(target,index){
var mainframe = document.getElementById("kj");
var dom = EUI.isNumber(index)?lisArr[index]:index;
var url = dom.getAttribute("url");
if(index==0){
mainframe.src = url?url:"http://218.93.10.45:4001/abi/ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$f7e4c8e977454275a02edfcf06a51d0c&id=dpbb&pw=dpbb&showmenu=false&calcnow=true&showparams=false"
}else if(index==1){
mainframe.src = url?url:"http://218.93.10.45:4001/abi/ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&id=dpbb&pw=dpbb&showmenu=false&calcnow=true&showparams=false"
} else if(index==2){
mainframe.src = url?url:"http://218.93.10.45:4001/abi/ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&id=dpbb&pw=dpbb&showmenu=false&calcnow=true&showparams=false"
} else if(index==3){
mainframe.src = url?url:"http://218.93.10.45:4001/abi/ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&id=dpbb&pw=dpbb&showmenu=false&calcnow=true&showparams=false"
} else if(index==4){
mainframe.src = url?url:"http://218.93.10.45:4001/abi/ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&id=dpbb&pw=dpbb&showmenu=false&calcnow=true&showparams=false"
} else{
mainframe.src = url?url:"http://218.93.10.45:4001/abi/ebibase/showcoolrpt.do?resid=EANA$2$4$1$NKUBMTVJPUYWLCCK9VI7P8MCTDK1BWT7$2cd4321f74ec4401b191a8fd7878cbab&id=dpbb&pw=dpbb&showmenu=false&calcnow=true&showparams=false"
}
console.log("您点击的是"+target.textContent);
}
但是我这么写点击后没有反应,可以帮忙看看问题在哪儿吗
nannan 发表于 2020-5-27 14:17
function eventFunc(target,index){
var mainframe = document.getElementById("kj");
...
现在问题解决了吗