手机页面用innerHTML拼接的图片不显示

测试代码



<!DOCTYPE HTML>
<html lang="ru-RU">
<head>
  <title>
</title>
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">

input,button{
height:35px;
}
</style>
</head>
<body>

<div id='aa' ></div>
<hr/>
<button id='bb'> add </button>


<script type="text/javascript">
function addEmotion(t){

alert(t);

}

var add=function(){
var prefix='http://192.168.1.100:88/emotion/images/';
var emotion=['hi','yes','good'];
var html=[];
for(var i=0;i<emotion.length;i++){
html.push("<li  name='"+emotion[i]+"' onclick='addEmotion(this);'  ><img src='"+prefix+emotion[i]+".gif'/></li>");

}

 

document.getElementById('aa').innerHTML="<dl >"+html.join("")+"</dl>";

}

document.getElementById('bb').addEventListener('click',add);


</script>
  
</body>
</html>

浏览器打开正常,但是用chrome device mode 或者手机直接访问,图片不显示
测试结果
图片描述

阅读 3.9k
1 个回答

换个可以在线访问的网址,手机能访问localhost?

推荐问题