随机图像调用Javascript在Chrome中不起作用,但在IE&;火狐
这是sharepoint母版页中的代码随机图像调用Javascript在Chrome中不起作用,但在IE&;火狐,javascript,Javascript,这是sharepoint母版页中的代码 <script language="JavaScript"> <!-- function top() { var begin = 1; var end = 63; var range = end-begin+1; image_num = Math.floor(Math.random()*range)+begin; //alert(image_num); document.write("<img src=\"http://exttem
<script language="JavaScript">
<!--
function top()
{
var begin = 1;
var end = 63;
var range = end-begin+1;
image_num = Math.floor(Math.random()*range)+begin;
//alert(image_num);
document.write("<img src=\"http://exttemplate.wsu.edu/extsharepoint/images/next/ext" + image_num + ".jpg\" width=\"775\" height=\"85\" border=\"0\">");
}
//-->
</script>
站点尝试类似以下内容:
function top()
{
var begin = 1;
var end = 63;
var range = end-begin+1;
image_num = Math.floor(Math.random()*range)+begin;
var img = document.createElement('img');
img.src = 'http://exttemplate.wsu.edu/extsharepoint/images/next/ext' + image_num + '.jpg'
img.style.width = '775';
img.style.height = '85';
img.style.border = '0';
document.getElementById('siteID').appendChild(img);
}
window.onload = function() {
top();
};
并将其包含在页面底部