Home > Article > Web Front-end > How to use hyperlinks to open new windows and control window properties in html
This time I will show you how to use a hyperlink to open a new window and control the window properties in HTML. What are the things to note when using a hyperlink to open a new window and control the window properties in HTML? The following is a practical case, let’s take a look.
1. The size of the window opened by the html hyperlink<a href="#" onclick="javascript:window.open('http://www.baidu.com','','height=20,width=20,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')">aaaaaaaaaaaaaaa</a>2. If there are many quotation marks in php, it is difficult to remove them. You can use the following methods:
$openNew="onclick=".'"'."javascript:window.open('host_graphics.php?host_id=$host_id&host_address=$host_address','','height=500,width=600,top=300,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')".'"'; echo "<td style='vertical-align: middle;text-align: center;'><a href=#?host_id=$host_id&host_address=$host_address name='host_click' style='text-decoration:underline;' title='点击查看主机系统监控图' $openNew> $host_name </a></td>"; //主机名 点击可查看选中主机的具体信息Tips:
onclick="javascript:window.open('12.php','','height=500,width=600,top=300,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')"The file can be followed by the value of the variable, for example
host_graphics.php?host_id=$host_id&host_address=$host_address, then you can use GET to obtain the value in the new window that pops up.
3. Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>ThD</title> </head> <body> </body> <a href="#" onclick="javascript:window.open('http://www.baidu.com','','height=500,width=600,top=300,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')">aaaaaaaaaaaaaaa</a> </html>I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website! Related reading:
How to use Meta tag code to make 360 Browser use speed mode to open web pages by default
The above is the detailed content of How to use hyperlinks to open new windows and control window properties in html. For more information, please follow other related articles on the PHP Chinese website!