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
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>
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>
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>