The JS TAB dynamically replaces the banner image path

  • 2020-06-07 04:01:47
  • OfStack

This article shows how the JS TAB dynamically replaces the banner image path. Share to everybody for everybody reference. The specific analysis is as follows:

Here's a TAB that shows how to dynamically replace an image, using a definition implemented by the JS function to mouse over the path of the replacement image.

Parameters are explained as follows:

The object for which obj is currently firing the event
The class name of the currently selected element of hc
content selects the image that needs to be replaced
url is the path of the picture

The code is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> TAB dynamic replacement banner Image path </title>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
 hoverFn($("ul li"),"hover_css",$("p img"),"big");// Call a function  
   Defines the path of the mouse over the replacement image 
  function  2012.8.24 
   The author  zoowar 
   Parameters that 
  obj  The object that currently fires the event 
  hc  The class name of the currently selected element 
  content  Select the image that you want to replace the path 
  url  Is the path of the picture 
 function hoverFn(obj,hc,content,url){
  var h_css=hc;  
  var imgUrl=$(this).attr(url);
<style type="text/css">
width:1024px;height:768px;margin:0 auto;
ul li{
border-bottom:solid 2px #FB066F;text-align:center;
ul li.hover_css{
border-bottom:solid 2px #06F;background:#f0f0f0;
<li class="hover_css" big="images/wall_s1.jpg"> The scenery </li>
<li big="images/wall_s2.jpg"> The beauty </li>
<li big="images/wall_s3.jpg"> Smart pan </li>
<li big="images/wall_s4.jpg"> A spoof </li>
<img src="images/wall_s1.jpg" />

I hope this article has been helpful for your javascript programming.

Related articles: