帝国cms7.0,调用带有标题图片的信息,有标题图片的用标题图片,没有标题图片的在默认的图片中随机调用,源代码信息如下:废话不多说,直接上代码,不明白的可以联系我。演示地址:http://www.wenzhaihui.com/tupian/index.html,源代码如下:
<script language="JavaScript">
today=new Date();
jran=today.getTime();
function rnd() {
ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
document.write("<center>");
for(i=1;i<=1;i++) {
myNum=(rand(20)); //改成你要随机显示的图片数;
if(myNum == 1) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/001.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>"); //图片路径,可用http://
if(myNum == 2) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/002.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 3) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/003.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 4) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/004.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 5) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/005.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 6) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/006.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 7) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/007.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 8) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/008.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 9) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/009.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 10) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/010.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 11) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/011.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 12) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/012.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 13) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/013.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 14) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/014.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 15) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/015.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 16) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/016.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 17) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/017.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 18) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/018.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 19) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/019.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
if(myNum == 20) document.write("<img src='[!--titlepic--]' onerror=this.src='[!--news.url--]skins/tup/020.jpg' alt='[!--oldtitle--]' width='130'height='130' border='0'>");
else {
document.write();
}
};
document.write("</center>");
</script>