Opening HTML link in new window

和自甴很熟 提交于 2019-12-04 06:01:06

问题


I've got a table that shows details about some products, which are stored in the database. These details are Item Name, Price and submit Date.

Item Name   Price   Submitted on
Laptop       £30     12/04/10
guitar       £5      12/05/10

If I click on Laptop I want to see all details such as Title, Price, Description, Picture, Contact name and email (all details are stored in the database) in a new windows.

I don't know if a PHP function will do it or maybe I need javascript?? I look on Google but I could find anything.

I hope you undestand my question


回答1:


Here is how you open a link in a new window.

<a href="detailsPage.php?itemID=1234" target="_blank">Name of your Product</a>



回答2:


This doesn't really have anything to do with PHP or MySQL.

Depending on the version of (X)HTML you're using you can either set the target attribute on the link...

<a href="..." target="_blank">...</a>

...or you can use a JavaScript function that makes use of window.open.




回答3:


There is no function in PHP for this as PHP runs on the server end. You would need to generate the HTML or JavaScript to do this either using the target="_blank" attribute on a link, or using JavaScript's window.open, depending on the desired result.




回答4:


You don't need java script or PHP.

This can be achieved by HTML.

<a href="xyz.php" target="_blank">Product</a>

target="_blank" is a attribute of <a> tag. Using this link can be opened in new window.



来源:https://stackoverflow.com/questions/3468374/opening-html-link-in-new-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!