English 中文(简体)
滚动案文超链接,成为图像
原标题:rollover a text hyperlink to become an image

如何做到这一点?

文本超链接一旦被搁置,文本链接就会成为形象吗?

iv 看到图像传播,但已经发现或知道如何将图像传播成像。

i 只字眼知道何时开始,方案措辞是什么。 javascript? php? jquery?

i 先采用以下守则:

<a href = "#" onmouseover = "(document.img.src)= SAM_2251.jpg ;">Mouseover here</a>

<img name = "img" alt = "" border = "0" />

但是,在图像被装在后面的时候,它还是把案文放在屏幕上。 i 想使案文完全摆脱形象。

任何帮助? 预言如此之多。

最佳回答

只有在被 h弃时,才能改变与图像的联系,在被 h离时成为文字(只有CSS)

<style>
.changeable img
{
  display:none;
}
.changeable:hover span
{
  display:none;
}
.changeable:hover img
{
  display:inline-block;
}
</style>
<a href="http://www.example.com" class="changeable"><span>Hyper Text</span><img src="img.png" /></a>

或者如果你想要与永久改变形象挂钩(用 j子)

<style>
.changeable img
{
  display:none;
}
</style>
<a href="http://www.example.com" class="changeable"><span>Hyper Text</span><img src="img.png" /></a>

<script type="text/javascript">
$( .changeable ).hover(function(){
  $(this).children( img ).show();
  $(this).children( span ).hide();
})
</script>
问题回答

你们可以只使用html,并使用一种背景形象:

html

<a href = "#" class="hover_image">Mouseover here</a>

c)

a.hover_image:hover {
    background: url(/url/to/image) no-repeat center center;
    text-indent: -9999em;
}

You probably need a bit more c) to define the width and height of the a tag, but this is the basics.

你在很多方面说得 ca,这里是特别安全局的一个粗略例子,只是看一看这一想法。

<http://jsfiddle.net/d5ym/3/>rel=“nofollow>try this

这里是这样做的 j脚石。

    <div id="link">    
    <a href = "#" onmouseover = "document.getElementById( link ).style.display= none ;document.getElementById( hoverImage ).style.display= block ;;">Mouseover here</a>  
</div>
<div id="hoverImage" style="display:none">
    <img name = "img" alt = "" border = "0" src="img.JPG" onmouseout = "document.getElementById( link ).style.display= block ;document.getElementById( hoverImage ).style.display= none ;;" />    
</div>

假定超文本为:

<a href="http://www.example.com/image.png" class="textToImg">Some text</a>

The following Java texts should work:

function textToImage(elem){
    if (!elem) {
        return false;
    }
    else {
        var img = document.createElement( img );
        img.src = elem.href;
        elem.removeChild(elem.firstChild);
        elem.appendChild(img);
    }
}

JS Fiddle evidence of concept.

也可以通过 j:

http://jsfiddle.net/pkZAW/“rel=“nofollow” 见《行动。

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>

<body>
<script type= text/javascript >
$( function() {
  $("#imglink").hover(
    function () {
      $(this).attr( small ,$(this).html());
      $(this).html($(this).attr( full ));
    },
    function () {
       $(this).html($(this).attr( small ));
    }
  );
});
</script>

<a herf="" id= imglink  full= <img border="0" src="someImage.png" width="163" height="37"/> >Rollover for image  n  rollout for text</a>

</body>
</html>




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签