2013-07-06 30 views
0

這裏是JSFiddle link作品JSFiddle不在網站目錄

該代碼可以正常工作,除非將其插入到我的index.html中,那麼瀏覽器無法調整圖標大小。

用我的index.html文件的標題下面的腳本標籤在我的web項目

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"/> 

你有任何想法,爲什麼這是不工作?

TY提前

下面是完整的代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    <head> 
     <title>Home page</title> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <meta http-equiv="Content-Style-Type" content="text/css" /> 
     <link href="style.css" rel="stylesheet" type="text/css" /> 
     <link href="layout.css" rel="stylesheet" type="text/css" /> 

     <!-- 
     David JavaScript code 
     --> 
     <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"/> 
      <script> 
      $(document).ready(function() { 
       $("#imghover1").mouseover(function() { 
        $("#imghover1").width(295); 
        $("#imghover1").height(54); 
       }); 
       $("#imghover1").mouseleave(function() { 
        $("#imghover1").width(245); 
        $("#imghover1").height(45); 
       }); 
      }); 

     </script> 


    </head> 

    <body id="page1"> 
     <div class="tail-top"> 
      <div class="tail-bottom"> 
       <div class="main"> 
        <div id="header"> 
         <ul> 
          <li class="first"><a href="index.html" class="current">Home page</a></li> 
          <li><a href="index-1.html">Company</a></li> 
          <li><a href="index-2.html">Registration</a></li> 
          <li><a href="index-3.html">IT Services</a></li> 
          <li><a href="index-4.html">Questionnaire</a></li> 
          <li><a href="index-5.html">Contact Us</a></li> 
         </ul> 
         <a href="#"><img alt="" src="images/button2.gif" class="button1" /></a> 
         <div class="indent2"><img alt="" src="images/icon1.gif" class="alignMiddle" /> &nbsp;<a href="login.jsp">login</a> &nbsp; &nbsp; &nbsp; &nbsp;<img alt="" src="images/icon2.gif" class="alignMiddle" /> &nbsp;<a href="#">search</a></div> 
         <div><a href="index.html"><img alt="" src="images/xxcloud.gif" id="imghover1" class="logo" width="245" height="45" /></a><br /></div> 

         <div class="indent"> 
          <img alt="" src="images/slogan.gif" /><br /> 
          <img alt="" src="images/title.gif" /><br /> 
          <p><strong>Donec accumsan malesuada orci. Donec sit amet eros. consectetuer adipiscing elit. Mauris fermentum dictum magna. Sed laoreet aliquam leo. Ut tellus dolor, dapibus eget elementum vel cursus eleifend elit. Aenean auctor wisi et urna. Aliquam erat volutpat. Duis ac turpis. </strong></p> 
          <a href="#"><img alt="" src="images/button.gif" class="button" /></a><br /> 
         </div> 
         <div class="indent1"> 
          <a href="#"><img alt="" src="images/banner1.jpg" /></a><a href="#"><img alt="" src="images/banner2.jpg" /></a><a href="#"><img alt="" src="images/banner3.jpg" /></a><a href="#"><img alt="" src="images/banner4.jpg" /></a><a href="#"><img alt="" src="images/banner5.jpg" /></a><br /> 
         </div> 
        </div> 
+0

將您的整個代碼粘貼到這裏,以便我們提供幫助。 – Nikola

+0

嘗試在'//ajax.googleapis ...'部分之前添加'http:'。 – lifetimes

+0

什麼是向我展示我的代碼的最佳方式,它的評論太長,我無法回答我的問題? – Dave

回答

0
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"/> 

應該是:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
+0

不能使用結束腳本標記。我已經試了這個 – Dave

+0

適合我,用你提供的代碼,不要忘了添加'http://'...因爲它不是完整的代碼 - 我可以在黑暗中拍攝...也許你有兩個相同的ID ...不知道... http://jsbin.com/aharuf/1/edit – sinisake

+0

我也指定了協議,沒有任何東西! – Dave

0

試試這個代碼,這是爲我工作。

<!DOCTYPE html> 
<html> 
<head> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
    <title> - jsFiddle demo</title> 

    <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script> 



    <link rel="stylesheet" type="text/css" href="/css/result-light.css"> 

    <style type='text/css'> 

    </style> 



<script type='text/javascript'>//<![CDATA[ 
    $(window).load(function() { 
     $(document).ready(function() { 
      $("#imghover1").mouseover(function() { 
       $("#imghover1").width(295); 
       $("#imghover1").height(54); 
      }); 
      $("#imghover1").mouseleave(function() { 
       $("#imghover1").width(245); 
       $("#imghover1").height(45); 
      }); 
     }); 
    });//]]> 

</script> 


</head> 
<body> 

<img alt="" src="http://placehold.it/700x1000" id="imghover1" class="logo" width="245" height="45" /> 

</body> 


</html> 
相關問題