2013-08-28 60 views
1

我正在设计一个网页,其中包含Facebook,Twitter链接至我的个人资料。我有这个。图片上的定位标记无法正常工作

<div> 
    <a href="https://www.facebook.com/xyz"> 
     <img src="../images/facebook.gif> 
    </a> 
</div> 

而且它的造型是

<style> 
    img 
    { 
     height:16px; 
     width:16px; 
    } 
</style> 

当我运行它,这就是我得到

function AjaxRequest(url) { 
    var http_request = false; 
    if (window.XMLHttpRequest) { //   Mozilla, Safari,... 
     http_request = new XMLHttpRequest(); 
     if (http_request.overrideMimeType) { 
      http_request.overrideMimeType('text/xml'); // See note below about this line 
     } 
    } else if (window.ActiveXObject) { // IE //isIE=true; 
     try { 
      http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
     } catch (e) { 
      try { 
       http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
      } catch (e) {} 
     } 
    } 
    if (!http_request) { 
     alert('Giving up :(Cannot create an XMLHTTP instance'); 
     return false; 
    } 
    http_request.onreadystatechange = function() { 
     showhtmlpageContents(http_request); 
    }; 
    http_request.open('GET', url, true); 
    http_request.send(null); 
    setTimeout("AjaxRequest('ups.jsp')", 5000); 
} 
function showhtmlpageContents(http_request) { 
    if (http_request.readyState == 4) { 
     if (http_request.status == 200 || window.location.href.indexOf("http") == -1) { 
      document.body.innerHTML = http_request.responseText; 
      if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) document.body.innerHTML = http_request.responseText; 
     } else { 
      document.body.innerHTML = http_request.responseText; //alert('There was a problem with the request.'); 
     } 
    } 
} 
+2

首先,除去*属性*名称和值之间的空间。您已将gorgot放在''src属性上的最后''',并且您是CSS声明的错误语法。 –

+0

请结束img标记.. –

+0

您错过了img src中的结尾引号'“'。 – rgin

回答

4
<img src="../images/facebook.gif"> 

行情失踪。

<div> 
    <a href="https://www.facebook.com/xyz"> 
     <img src="../images/facebook.gif"> 
    </a> 
</div> 

CSS

<style> 
    img 
    { 
     height:16px; 
     width:16px; 
    } 
</style> 
-1

试试这个。

<a href = "https://www.facebook.com/xyz"> 
    <img src="../images/facebook.gif"> 
</a> 

的CSS:

<style> 
    img{ 
    height:16px; 
    width:16px; 
    } 
</style> 
-1

试试这个:

<div> 
<a href="https://www.facebook.com/xyz"><img src="../images/facebook.gif"></a> 
</div> 

<style> 
img { height: 16px; width: 16px; } 
</style> 
0

尝试这样

<a style="display:block; href ="https://www.facebook.com/xyz"> 
     <img src = "../images/facebook.gif"> 
    </a> 
+1

它不工作! – ShaileshDev