2012-01-12 157 views
-2

我需要帮助创建一个jquery函数,该函数将在单击图像时显示弹出消息。每个图像都会有不同的弹出消息。这里是我的HTML代码:根据点击的内容显示不同的弹出消息

<table> 
<tr> 
    <td> 
     <a href="#"> 
      <img src="/face.jpg" /> 
      <span> 
       <div class="bubble"> 
        THIS IS MY POPUP MESSAGE 1 
       </div> 
      </span> 
     </a>  
    </td> 

    <td> 
     <a href="#"> 
      <img src="/face.jpg" /> 
      <span> 
       <div class="bubble"> 
        THIS IS MY POPUP MESSAGE 2 
       </div> 
      </span> 
     </a>  
    </td> 

    <td> 
     <a href="#"> 
      <img src="/face.jpg" /> 
      <span> 
       <div class="bubble"> 
        THIS IS MY POPUP MESSAGE 3 
       </div> 
      </span> 
     </a>  
    </td> 
</tr> 

+0

window.open(“http://www.javascript-coder.com”,“mywindow”); – zod 2012-01-12 18:33:49

回答

1

我给你相同水平的答案的问题。我的好办法,然而,你必须包括jQuery UI的

CSS

a span {display: none} 

下载,包括jQuery UI的

HTML

<script src="javascripts/jquery-ui.js"></script> 

JS

$('a').click(function() { 
    $(this).find('span').dialog(); 
}) 
+0

谢谢凯尔,我能根据你的答案解决它。这里是我有什么:$('a.hover1')。mouseover(function(){$(this).find('span')。show(); \t})。mouseout(function(){ \t \t $(this).find('span')。hide(); \t}); – JONxBLAZE 2012-01-12 21:49:16