0

关于为什么这些脚本中的一个有效,而另一个无效,我正在大发雷霆。单击文本后,图像应更改。另外,load() 命令看起来还可以吗?

使第一个工作和第二个故障的这两个有什么区别?

功能性:

CageImg=new Image();
CageImg.src="http://cageme.herokuapp.com/css/mrcage.jpg"

function buttonInCompany() 
{
$('#desc').load('incompany.html'); 
$('#midimg').attr("src",CageImg.src); } 

$(document).ready(function() { $("#someID").click(function() { buttonInCompany(); }); }); </script>

<div id='someID'>Everything is cage's cage.<br><br></div>

<img id="midimg" src="http://3.bp.blogspot.com/-BdfyYy_Y0gY/UP_3y3F2RDI/AAAAAAAAC-Q/eHPCltO8bG8/s1600/TomEngelsnicolas+thing.jpg">

非功能性:

    <script src="jquery.src"></script>
        <script>
        incompanyImage=new Image(); 
        incompanyImage.src= "images/16581370-group-of-happy-young-business-people-in-a-meeting-at-office.jpg" 

function buttonInCompany()

        {
        $('#desc').load('desc.html #incompany');
        $('#midimg').attr("src",incompanyImage.src); } 

        $(document).ready(function() { $("#incompany").click(function() { buttonInCompany(); }); }); 

        </script>

        <div id="incompany" class="art-button">Aulas in-Company</div>

        <img id="midimg" width="233" height="350" src="images/Fotolia_5170186_X-01.jpg"><br></p>
4

0 回答 0