what wrong on my Function of link to open new wind

2019-09-18 02:36发布

问题:

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. ?

回答1:

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



回答2:

Try

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



回答3:

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

genLink = " onclick=window.open(""location.href='order_view.asp?bill_id=" & req_id & "'  "" )" 


回答4:

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