Home >Web Front-end >HTML Tutorial >Add a hyperlink to the html button, pointing to a txt_html/css_WEB-ITnose on the server

Add a hyperlink to the html button, pointing to a txt_html/css_WEB-ITnose on the server

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:45:121480browse

Add a hyperlink to the html button, pointing to a txt on the server

The button name is download, add a hyperlink to it, pointing to a txt file on the server, this is similar to the download function


How to write the code?

Newbie, please give me some guidance


Reply to the discussion (solution)

It seems that it needs to be placed on the server to be effective, you can try it

<!DOCTYPE html><html><head>	<title>按钮下载文本</title>	<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script></head><body>	<input type="button" value="下载百度logo,就是这么任性" id="downloadBaidu" /></body><script type="text/javascript">	$("#downloadBaidu").click(function(){		//下面是输入的地址.		location.href="https://www.baidu.com/img/bd_logo1.png";	})</script></html>

It seems that it needs to be placed on the server to be effective. You can try

<!DOCTYPE html><html><head>	<title>按钮下载文本</title>	<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script></head><body>	<input type="button" value="下载百度logo,就是这么任性" id="downloadBaidu" /></body><script type="text/javascript">	$("#downloadBaidu").click(function(){		//下面是输入的地址.		location.href="https://www.baidu.com/img/bd_logo1.png";	})</script></html>



Server What about the local files of ?


It seems that it has to be placed on the server to be effective. You can try

<!DOCTYPE html><html><head>	<title>按钮下载文本</title>	<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script></head><body>	<input type="button" value="下载百度logo,就是这么任性" id="downloadBaidu" /></body><script type="text/javascript">	$("#downloadBaidu").click(function(){		//下面是输入的地址.		location.href="https://www.baidu.com/img/bd_logo1.png";	})</script></html>



local to the server Where are the files?

I mean you have to put this html and that file on the server.



It seems that it needs to be placed on the server to be effective. Can you try

<!DOCTYPE html><html><head>	<title>按钮下载文本</title>	<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script></head><body>	<input type="button" value="下载百度logo,就是这么任性" id="downloadBaidu" /></body><script type="text/javascript">	$("#downloadBaidu").click(function(){		//下面是输入的地址.		location.href="https://www.baidu.com/img/bd_logo1.png";	})</script></html>



What about the local files of the server?

I mean you have to put this html and that file on the server.
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