Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用下载按钮从页面下载图像_Javascript_Css - Fatal编程技术网

Javascript 使用下载按钮从页面下载图像

Javascript 使用下载按钮从页面下载图像,javascript,css,Javascript,Css,我在页面上有一个图像和一个下载按钮。我想点击下载按钮,图像需要下载(*可以是任何格式) 下面是我的图片代码和下载按钮 <Style> .results img { position: absolute; top: 33%; left: 25.5%; width: 50%; height: auto; .button img{ position: absolute; left: 50%; top: 94.5%; </style> <div class="resu

我在页面上有一个图像和一个下载按钮。我想点击下载按钮,图像需要下载(*可以是任何格式)

下面是我的图片代码和下载按钮

<Style>
.results img {
position: absolute;
top: 33%; 
left: 25.5%;
width: 50%;
height: auto;

.button img{
position: absolute;
left: 50%;
top: 94.5%;
</style>

<div class="results">
<img src="Images\pic.png">
</div>

<div class="Button">
<input id="test1" name="test1" type="image" src="images/download.png" value="myValue" alt="" onClick=""></div>

.结果img{
位置:绝对位置;
最高:33%;
左:25.5%;
宽度:50%;
高度:自动;
.按钮式img{
位置:绝对位置;
左:50%;
最高:94.5%;
谁能给我推荐一个JavaScript解决方案来实现这一点。

#图像{
浮动:左;
}
#dwnld{
浮动:左;
}
.按钮{
外观:按钮;
-moz外观:按钮;
-webkit外观:按钮;
文字装饰:无;字体:菜单;颜色:按钮文字;
显示:内联块;填充:2px 8px;
字体大小:15px;
}

来自