導航:首頁 > 編程語言 > js中打開圖片

js中打開圖片

發布時間:2023-02-21 07:02:00

❶ 怎麼讓js 里的圖片鏈接成為在新窗口打開

$('mainphofo').onclick = function() {location = this.getAttribute('name');}
改成
$('mainphofo').onclick = function() {window.open(this.getAttribute('name'));}

javascript打開新窗口顯示圖片,怎麼用js文件實現

其實很簡單,就像xiangyuecn回答的那樣。不過那是開新的瀏覽器窗口顯示圖片,如果你要在同一個窗口顯示,那就要用到JS。

❸ JS圖片新窗口打開

<a href='' target='_blank'></a>
在a標簽中添加target='_blank'屬性

❹ javascript打開新窗口顯示圖片,怎麼用js文件實現

window.open(surl,
sname);
surl
是一個字元串,它指定了要顯示文檔的url。如果不指定url,就產生一個空窗口。
sname
是定義的窗口名字,這個名字被用於<form>或者<a>標記的
target
屬性。在internet
explorer
5
和以後版本,如果定義這個數值為
"_search",那麼就將在瀏覽器的搜索區打開
surl

❺ javascript:點擊圖片打開新窗口瀏覽圖片

方法一:
<style>
img{
width:50%;
height:50%
}
</style>
<img src=1.PNG onclick="lookimg(this.src)">
<script>
function lookimg(str)
{
var newwin=window.open()
newwin.document.write("<img src="+str+" />")
}
</script>

方法二版權:
<img src=1.png onclick="lookimg(this.src)">
<script>
function lookimg(str)
{
var newwin=window.open()
myimg=newwin.document.createElement("img")
myimg.src=str
newwin.document.body.appendChild(myimg)
}
</script>

❻ js彈出圖片怎麼寫網頁一打開就彈出一張照片的那種!

沒明白你的意思。我寫的你看看能用就採用

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> </title>
</head>
<style>
.img{
position: fixed;
z-index: 10;
top:50%;
left: 50%;
margin-top: -200px;
margin-left: -200px;
}
#close{
position: absolute;
left: 10px;
top: 5px;

}
body{
background-color: #333;
}
</style>

<body>
<div class="mask"></div>
<div class="img">
<span id="close">關閉</span>
<img src="dd.png" alt="">
</div>
</body>
<script>
var mask = document.getElementById('close');
var img = document.getElementsByTagName('img')[0];
mask.onclick=function(){
img.style.display = "none";
this.style.display = "none";
}
</script>
</html>

沒明白你的意思。我想的是打開頁面的時候就是一個彈窗狀態,當我點擊關閉後彈窗圖片消失。我中間的白色「找不到伺服器」是圖片

❼ 用JS在新窗口打開本圖片

<img src="圖片連接" width="400" height="400" onclick="op(this.src)" />
<script language="javascript">
function op(c_url)
{
window.open(c_url)
}
</script>

❽ js 圖片新窗口打開自動適應大小

你這樣做是不行的,因為你彈出窗口url直接是個圖片的地址,因此彈出窗口沒有body對象,這樣內就無法容通過腳本來進行控制。

可行的辦法是將你的圖片寫入到一個臨時的a.htm中,這樣在a.htm中就可以非常方便的設置窗口邊距了。

<body margin=0 padding=0>

❾ 需要一個js腳本,實現打開圖片功能

最好不要使用替換的方式
使用JS 點擊打開方式會比較好

imglist=document.getElementsByTagName("IMG")
for(var i=0;i<imglist.length;i++){
o=imglist[i]
o.onclick=window.open(this.src);
o.style.cursor="pointer";
}
/*
javascript:document.getElementsByTagName("IMG")[0].getAttribute("src")

*/

❿ 如何用JS語句顯示圖片

需要准備的材料分別有:電腦、html編輯器、瀏覽器。

1、首先,打開html編輯器專,新建html文件,例如:index.html。

閱讀全文

與js中打開圖片相關的資料

熱點內容
word2007密碼設置 瀏覽:593
iPhone5解鎖密碼格圖案 瀏覽:392
微信文件怎麼填 瀏覽:87
燕十八老師精通mysql視頻教程 瀏覽:255
汽車保養數據怎麼清 瀏覽:629
pdf文件圖像打不開 瀏覽:176
msp430時鍾程序 瀏覽:660
查看sd卡文件系統格式 瀏覽:696
c盤中顯示隱藏文件 瀏覽:951
蘋果升級系統白屏 瀏覽:136
三菱gxplc編程軟體如何使用 瀏覽:710
海康威視手機app怎麼看不了 瀏覽:482
wordpress下載中心插件 瀏覽:402
微信限制字數是多少 瀏覽:20
策劃輸出主要從哪些文件來 瀏覽:174
網路營銷找什麼工作 瀏覽:372
tcl匹配文件名的正則表達式 瀏覽:461
音頻文件數據量為何8 瀏覽:534
有哪些分享學習的網站 瀏覽:174
小程序文件發到微信電腦如何打開 瀏覽:265

友情鏈接