怎么在HTML中添加广告位

怎么在HTML中添加广告位,第1张

在HTML中添加广告位方法:

在HTML中添加广告位

工具/原料

广告代码

方法

1、图片广告代码的“格式”

是:<a href="此处添加图片广告指向的网址" target="_blank"><img src="此处添加图片路径地址" width="此处写入图片宽度像素" height="此处写入图片高度像素" border="0" /></a>

2、下面举例说明:

先准备一张广告图片,然后,将图片用FTP工具上传到网站空间,上传的位置没有特别的要求,一般是上传到images(图片)文件夹中,这样方便管理;

3、将图片广告要指向的网址和图片广告的路径地址及图片广告的规格写进“图片广告代码中”。如,图片广告要指向的网址是:/图片广告存放的路径是:域名/themes/tomhua/images/ad.jpg;图片广告的尺寸是240×200。

4、这段代码就写成这样:

<a href="域名" target="_blank"><img src="域名/conten/themes/tomhua/images/ad.jpg" width="240px" height="200px" border="0" /></a>

5、将上述代码写进网站广告位或其他地方,更新一下,图片广告就会在你的网站上显示了。

6、这里需要注意的是图片存放的路径,要包括图片的名称,就是上面代码中的“ad.jpg”部分,整个代码不能出现一点差错,否则,广告图片就不能正常显示了。

7、另外,广告图片的尺寸是可以调整的,就是在“width="240px" height="200px"”这里调整到合适的大小就可以。“width”是广告图片的宽度“height”是广告图片的高度。

你好不清楚你要问甚么HTML

在插入图片时候是这样使用img

src=

这里就是你的图片地址假设你的html

文档和你的图片放在同1文件夹下面那末img

src=

完全图片名称假设你的图片放在html

文档的上1级目录那末img

src=

../完全图片名称假设你的图片放在html

文档的上两级目录那末img

src=

../../完全图片名称以此类推假设你的图片放在html

文档的下1级目录那末img

src=

/文件夹名字/完全图片名称假设你的图片放在html

文档的下两级目录那末img

src=

/文件夹名字1/文件夹名字2/完全图片名称以此类推固然你也能够使用图片的绝对地址:即把该图片实际所处位置的完全路径放进scr属性里面

<html><head><title>页面两侧漂浮的图片对联广告(二)带同时关闭功能丨芯晴网页特效丨CsrCode.Cn</title><meta http-equiv="content-Type" content="text/htmlcharset=gb2312"></head><body> <!--把下面代码加到<body>与</body>之间--><script language="javascript"><!-- var showad = truevar Toppx = 60//上端位置 var AdDivW = 100//宽度 var AdDivH = 300//高度 var PageWidth = 700//页面多少宽度象素下正好不出现左右滚动条 var MinScreenW = 1024//显示广告的最小屏幕宽度象素 var ClosebuttonHtml = '<div align="right" style="position: absolutetop:0pxright:0pxmargin:2pxpadding:2pxz-index:2000"><a href="javascript:" onclick="hidead()" style="color:redtext-decoration:nonefont-size:12px">关闭</a></div>' var AdContentHtml = '<a href=" http://www.7caidy.com " target="_blank"><img src="/images/20110630/a_d_100.gif" width="100" height="300" border="0">'document.write ('<div id="Javascript.LeftDiv" style="position: absoluteborder: 1px solid #336699background-color:#EEEEE2z-index:1000width:'+AdDivW+'pxheight:'+AdDivH+'pxtop:-1000pxword-break:break-alldisplay:none">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>')var ClosebuttonHtml = '<div align="right" style="position: absolutetop:0pxright:0pxmargin:2pxpadding:2pxz-index:2000"><a href="javascript:" onclick="hidead()" style="color:redtext-decoration:nonefont-size:12px">关闭</a></div>' var AdContentHtml = '<a href=" http://www.33567.cn " target="_blank"><img src="/images/20110630/a_d_100.gif" width="100" height="300" border="0">'document.write ('<div id="Javascript.RightDiv" style="position: absoluteborder: 1px solid #336699background-color:#EEEEE2z-index:1000width:'+AdDivW+'pxheight:'+AdDivH+'pxtop:-1000pxword-break:break-alldisplay:none">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>')function scall(){ if(!showad){return} if (window.screen.width<MinScreenW){ alert("临时提示:\n\n显示器分辨率宽度小于"+MinScreenW+",不显示广告")showad = falsedocument.getElementById("Javascript.LeftDiv").style.display="none"document.getElementById("Javascript.RightDiv").style.display="none"return} var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2document.getElementById("Javascript.LeftDiv").style.display=""document.getElementById("Javascript.LeftDiv").style.top=document.body.scrollTop+Toppxdocument.getElementById("Javascript.LeftDiv").style.left=document.body.scrollLeft+Borderpxdocument.getElementById("Javascript.RightDiv").style.display=""document.getElementById("Javascript.RightDiv").style.top=document.body.scrollTop+Toppxdocument.getElementById("Javascript.RightDiv").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx} function hidead() { showad = falsedocument.getElementById("Javascript.LeftDiv").style.display="none"document.getElementById("Javascript.RightDiv").style.display="none"} window.onscroll=scallwindow.onresize=scallwindow.onload=scall//--></script><br><br><br><br><br><br><br><br><br><br><br><br><hr><p align="center"><font color=black>本特效由 <a href=" http://www.CsrCode.cn " target="_blank">芯晴网页特效</a>丨CsrCode.Cn 收集于互联网,只为兴趣与学习交流,不作商业用途。来源:中国站长天空</font></p><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></body></html>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6283386.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-19
下一篇 2023-03-19

发表评论

登录后才能评论

评论列表(0条)

保存