网页上的Url按钮 [英] Url button from web

查看:149
本文介绍了网页上的Url按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有这样的按钮:

 < p> 
上传:< br>
< br>
< input type =filename =datafilesize =40>
< / p>

是否可以有一个按钮,用户可以在其中包含(复制/粘贴)照片在网络上的某个地方?



示例:我想要按下按钮,它会要求用户从Web插入图像链接,如这个,它会拍照

解决方案

我明白这是一个模糊的答案,但它只是和你的问题一样模糊。如果这不是您想要的,请告诉我们最终结果应该是什么样子。



function writeImage(url){document.body。 innerHTML ='< img src =''+ url +'/>'; }

< input type =textid = imgUrlsize =30value =http://placekitten.com/g/300/200placeholder =image url here/>< input type =buttonvalue =插入图片onclick = writeImage(document.getElementById('imgUrl')。value)/>

复制并粘贴到网页中:

 < input type =textid =imgUrl size =30value =http://placekitten.com/g/300/200placeholder =image url here/>< input type =buttonvalue =插入图片onclick =writeImage (的document.getElementById( 'imgUrl的')的值)/> 

< script>
函数writeImage(url){

var URL = url;

var myWindow = window.open(,_blank,width = 300,height = 200);

myWindow.document.write(< img src ='+ url +'/>);

}
< / script>


There are buttons like this:

 <p>
   Upload:<br>
  <br>
   <input type="file" name="datafile" size="40">
  </p>

Is it possible to have a button in which user can include (copy/paste) the url of a photo somewhere in the web?

Example: I want to have press button which will ask the user to insert a link of image from web like this and it will take the picture

解决方案

I understand that this is a vague answer, but it's only as vague as your question. If this is NOT what you want, please tell us what the end result should look like.

function writeImage(url){
  
  document.body.innerHTML = '<img src="' + url + '"/>';
  
  }

<input type="text" id="imgUrl" size="30" value="http://placekitten.com/g/300/200" placeholder="image url here"/><input type="button" value="Insert Image" onclick="writeImage(document.getElementById('imgUrl').value)"/>

Copy and paste this into a webpage:

    <input type="text" id="imgUrl" size="30" value="http://placekitten.com/g/300/200" placeholder="image url here"/><input type="button" value="Insert Image" onclick="writeImage(document.getElementById('imgUrl').value)"/>

<script>
function writeImage(url){

  var URL = url;

  var myWindow = window.open("", "_blank", "width=300, height=200");

myWindow.document.write("<img src='" + url + "'/>");

  }
</script>

这篇关于网页上的Url按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆