Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

javascript - 如何在新窗口中打开链接?(How can I open a link in a new window?)

I have a click handler for a specific link, inside that I want to do something similar to the following:(我有一个特定链接的点击处理程序,在里面我想做类似以下的事情:)

window.location = url I need this to actually open the url in a new window though, how do I do this?(我需要这个在新窗口中实际打开网址,我该怎么做?)   ask by Chris translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can like:(你可以这样:)

window.open('url', 'window name', 'window settings') jQuery:(jQuery的:) $('a#link_id').click(function(){ window.open('url', 'window name', 'window settings'); return false; }); You could also set the target to _blank actually.(您也可以将target设置为_blank 。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...