如何在html中的button标记中提供href
how to give a href inside the button tag in html
当在html页面中单击按钮时,我需要打开两个链接。我通过调用onclick函数并使用Javascript中的createElement创建锚标记来实现它。但是如何包含另一个链接??有没有办法在按钮标签中提供href??
您只需使用javascript 即可实现
window.open(url1);
window.open(url2);
如果你想在当前窗口中打开其中一个链接,你可以用这个代替window.open
window.location = url1;
<input type="button" value="Double Clicker" onclick="window.open("http://www.google.com/"); window.open("http://www.youtube.com/");" />
有关更多信息,请参阅此链接,
您需要使用javascript事件使页面进入
<input type="button" name="button1" value="Go To Url" onClick="window.navigate('URL')">
您也可以使用
location.href=" ";`
试着看看位置对象能做什么=>http://www.w3schools.com/jsref/obj_location.asp您应该能够加载两个选项卡。
为什么不使用引导
<a href="#" class="btn btn-default">
它显示一个按钮,链接指向href
相关文章:
- 在单击href链接的同时下载文件
- 如果href包含X,请更改href
- 锚点元素的href属性自动更改
- 锚点元素不't使用svg时,请打开EDGE上的href
- 检测电话窃听,即:<a href="电话:xxx">在UIWebview上
- 如何覆盖锚点元素's href目标,并在我点击转到目标javascript时删除其他错误
- Href:当前DIV中的目标ID
- javascript button target_blank?
- href属性内的javascript函数
- ng绑定和ng href问题.ng href未从控制器加载数据
- 如何将href设置为不同的值
- 获取打开jquery对话框的button的id
- 如何提取“;href"最近列表项中的属性值
- CKEditor如何允许href="javascript:void(0)"在小部件中
- HTML Button and href prbolem
- bootstrap button onclick and location.href
- Javascript:href button 模拟点击
- 如何在html中的button标记中提供href
- Button href changed by select list won't resolve (javasc
- href/button单击将否决下一步,并在不等待用户输入的情况下执行操作