Home  >  Article  >  Web Front-end  >  How to control the properties of html when opening a new window with a hyperlink

How to control the properties of html when opening a new window with a hyperlink

php中世界最好的语言
php中世界最好的语言Original
2018-01-31 09:32:112412browse

This time I will show you how to control the properties of html when opening a new window with a hyperlink, and how to control its properties when opening a new window with a hyperlink. What are the precautions?The following is a practical case, one Get up and take a look.

1. The size of the window opened by the html hyperlink

<a href="#" onclick="javascript:window.open(&#39;http://www.baidu.com&#39;,&#39;&#39;,&#39;height=20,width=20,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no&#39;)">aaaaaaaaaaaaaaa</a>

2. If there are many quotation marks in php and it is difficult to remove them, you can use the following methods:

$openNew="onclick=".&#39;"&#39;."javascript:window.open(&#39;host_graphics.php?host_id=$host_id&host_address=$host_address&#39;,&#39;&#39;,&#39;height=500,width=600,top=300,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no&#39;)".&#39;"&#39;; 
echo "<td style=&#39;vertical-align: middle;text-align: center;&#39;><a href=#?host_id=$host_id&host_address=$host_address name=&#39;host_click&#39; style=&#39;text-decoration:underline;&#39; title=&#39;点击查看主机系统监控图&#39; $openNew> $host_name </a></td>"; //主机名 点击可查看选中主机的具体信息

Tips:

onclick="javascript:window.open(&#39;12.php&#39;,&#39;&#39;,&#39;height=500,width=600,top=300,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no&#39;)"

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(&#39;http://www.baidu.com&#39;,&#39;&#39;,&#39;height=500,width=600,top=300,left=300,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no&#39;)">aaaaaaaaaaaaaaa</a> 
</html>

I believe you have mastered the method after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

font-weight: How to use CSS to solve the bod problem of blod

How to use rem on the mobile phone +scss adaptation

html5How to create an animation effect of a picture rotating in a circle

The above is the detailed content of How to control the properties of html when opening a new window with a hyperlink. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn