what wrong on my Function of link to open new wind

2019-09-18 02:07发布

I've tried to create link that can open new window..currently I used

Function genLink(req_id)
    genLink = " onclick=""location.href='order_view.asp?bill_id=" & req_id & "'  "" "
End function

it's work well but just can't make it open link in new window. So i've searched found that it need to be use window.open instead so I do like below.. But it's not work..

Function genLink(req_id)
    genLink = " onclick=""window.open='order_view.asp?bill_id=" & req_id & "' ,'_blank'  "" "   
End function

so could you please tell me what did I do wrong. ?

4条回答
做自己的国王
2楼-- · 2019-09-18 02:53

window.open is a javascript function, not a property. Try

genLink = " onclick=window.open(""location.href='order_view.asp?bill_id=" & req_id & "'  "" )" 
查看更多
Deceive 欺骗
3楼-- · 2019-09-18 02:53

Looks like too many messing "(double quotes), anyways window.open is a function, so it should be as below..
onclick="window.open('myurl')"

查看更多
戒情不戒烟
4楼-- · 2019-09-18 02:56

Try: window.open("order_view.asp?......"); Refer here: http://www.w3schools.com/jsref/met_win_open.asp

查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-09-18 03:02

Try

onclick="window.open('order_view.asp?bill_id='+bill_id+'&req_id='+req_id)"

查看更多
登录 后发表回答