SoFunction
Updated on 2025-03-10

js to realize the method of clicking on the image to copy the image address to the paste board


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta name="robots" content="all" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Click on the image to copy the image address directly to the paste board</title>
<style type="text/css">
 #www_jb51_net_hidden {
  position:absolute;
  visibility:hidden;
 }
 img {
  cursor:pointer ;
 }
</style>
</head>
<body>
Click the picture below to get the address directly.
 <div >
  <img src="images/"><br />
 </div>
 <span ></span>
</body>
<script type="text/javascript">
<!--
 $id=function(id) {
  return (id);
 }
 var objs =$id("jb51_net").getElementsByTagName("img") ;
 for (var i=0;i<;i++ ) {
  objs[i].onclick=function () {
   $id("www_jb51_net_hidden").innerHTML= ;
   var my_range =() ;
   my_range.moveToElementText($id("www_jb51_net_hidden"));
   my_range.execCommand("copy");
alert("The image address has been copied to the clipboard");
   return false ;
  }
 }
//-->
</script>
</html>