導航:首頁 > 文字圖片 > js圖片加文字

js圖片加文字

發布時間:2022-05-06 23:10:23

❶ js 可以動態處理圖片為其加文字

js本身不能處理圖片
只是在圖片上層可以加入一個dom節點,填入文字
需要用css控制
position: relative|absolute

❷ js點擊圖片在文本框內顯示文字

親,改一下js代碼,改成這樣就可以了

<scripttype="text/javascript">
tb=document.getElementById('textbox');
spans=document.getElementsByTagName("span");
for(vari=0;i<spans.length;i++)
{
spans[i].index=i;
spans[i].onclick=function()
{
alert(spans[this.index-1].innerHTML);
}
}
</script>

怎麼在js控制的背景圖片里添加文字

將 id="bg" 這個 div 的 style(樣式)中的 position(位置)設置為 relative(相對),
然後在裡面加一個 div 寫文字,將它的 position 設置為 absolute(絕對),調整 top 和 left 來改變它的顯示位置。

把 div 替換為下面這樣

<div id="bg" style="position: relative;">
<div id="text" style="position: absolute; top: 100px; left: 200px;"><p>添加文字</p></div>
<img src="圖片地址自己換上" alt="HIGH">
</div>

❹ js在圖片上插入文字的代碼

添加一個標簽,
然後把這個標題定位到圖片的上方就可以了。
不需要用js。

❺ 在JS中怎麼往圖片上添加文字

文字用css絕對定位就可以了

❻ 怎樣用js判斷不同的域名放不同的圖片和文字

JS獲取域名的方法:window.location.host或者document.domain,
再根據獲取的域名判斷要顯示的內容,分別給對應容器添加圖片和文字就可以了

❼ js圖片和文字同時切換的效果

<script language=JavaScript>
var imgUrl=new Array();
var imgLink=new Array();
var imgTitle=new Array();
var adNum=0;
var it=1;

<% for i=1 to 3%>
imgUrl[<%=i%>]="./dhdd/adm/upfile/photo/<%=rs("mshowimage")%>";
imgLink[<%=i%>]="#";
imgTitle[<%=i%>]="<%=rs("文字說明欄位名稱")%>";
<% rs.movenext
next%>

var imgPre=new Array();
var jj=0;
for (i=1;i<=3;i++) {
if( (imgUrl[i]!="") && (imgLink[i]!="") ) {
jj++;
} else {
break;
}
}
function playTran(){
if (document.all){
document.imgInit.filters[0].play();
}
}
function nextAd(){
if(adNum<jj)adNum++ ;
else adNum=1;

if (document.all){
document.imgInit.filters[0].Transition=26;
document.imgInit.filters[0].apply();
}
document.images.imgInit.src=imgUrl[adNum];
document.images.imgInit.title=imgTitle[adNum];
playTran();
theTimer=setTimeout("nextAd()", 3000);
}
function goUrl(){
jumpUrl=imgLink[adNum];
jumpTarget='_blank';
if (jumpUrl != ''){
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else
location.href=jumpUrl;
}
}
</script>
<a href="javascript:goUrl()" target="_self"><img style="FILTER: progid:DXImageTransform.Microsoft.RevealTrans (ration=1,transition=3);border-color:#000000;color:#000000;margin-bottom:0px" src="javascript:nextAd()" width="210" height="150" border="0" name=imgInit>

❽ js如何給多個圖片添加hover文字

const imgList = document.getElementsByClassName('content')[0].getElementsByTagName('img')
for(let i=0;i<imgList.length;i+=1){
$(imgList[i]).hover(function(){
$(imgList[i]).css("background-color","yellow")
},function(){
$(imgList[i]).css("background-color","transparent")
})
}
混著用的 js的寫法復雜一點 所以引入了jq寫的

閱讀全文

與js圖片加文字相關的資料

熱點內容
13歲兒童女孩漂亮的衣服圖片 瀏覽:240
矮個子搭配什麼衣服好看圖片 瀏覽:232
動漫打架的圖片 瀏覽:923
word裡面怎麼均勻插入多張圖片 瀏覽:650
初生嬰兒衣服圖片 瀏覽:156
多可愛的圖片 瀏覽:548
親子繪畫簡單作品圖片 瀏覽:489
word圖片邊框怎麼對齊 瀏覽:907
ps圖片有色塊怎麼簡單 瀏覽:193
唐嫣的中分發型圖片 瀏覽:574
穿涼鞋的美女腳圖片 瀏覽:837
經典旗袍衣服圖片 瀏覽:166
紅色衣服圖片有哪些 瀏覽:506
最破爛的衣服圖片 瀏覽:46
qq萌女孩圖片頭像卡通頭像 瀏覽:193
男生手機照片發型圖片 瀏覽:879
中卷短發發型圖片2015女 瀏覽:524
男生頭像圖片小清新簡單干凈 瀏覽:252
美女抱帥哥圖片 瀏覽:68
女生的小房間圖片 瀏覽:847