Solved

click event doesnt work

Posted on 2013-05-17
5
333 Views
Last Modified: 2013-05-22
Hi,

I cant click on my link that is in a div(2nd link). I need this to link to be in a div to swap an image.
How do I enable the click event like the 1st link does?

<a href="home.html"><img  src="images/ic1.png" alt=""/></a>

 
<div id="imgswap"> <a href="home.html"><img id="imgswap" src="images/ic1.png" alt=""/></a></div>  //click event doesnt work?

Open in new window

0
Comment
Question by:jagguy
5 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39176415
You should post your entire page because that code works as is
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39176421
0
 

Accepted Solution

by:
jagguy earned 0 total points
ID: 39176435
OK I found better code to make it work.
I do put it in a list and just swap images over hover.


ul.nav
{
    list-style-type: none;
    padding: 0;
    margin: 0;
    float: left;
    
}

ul.nav a
{
    border: 0px solid #cccccc;
    display: block;
    height: 100px;
    padding-top: 72px;
    width: 100px;
    
}

.nav li#welcome a {
	 background-image:url(images/ic1.png); 
  background-repeat: no-repeat; 
	 
	 }
.nav li#welcome a:hover {
	 background-image:url(images/ic1b.png); 
  background-repeat: no-repeat; 
   }

.nav li#welcome2 a {
	 background-image:url(images/ic1.png); 
  background-repeat: no-repeat; 
	 
	 }
.nav li#welcome2 a:hover {
	 background-image:url(images/ic1b.png); 
  background-repeat: no-repeat; 
   }
 
 
   
#head{
	
}
	
</style>
</head>

<body>


<div id="head">
  <ul class="nav">
    <li id="welcome"><a href="home.html"></a></a></li>
    <li id="welcome2"><a href="home.html"></a></a></li>
  </ul>
</div>

Open in new window

0
 
LVL 9

Expert Comment

by:Sar1973
ID: 39176848
Try to assign another ID to the div: they are identical.
0
 

Author Closing Comment

by:jagguy
ID: 39186895
I found solution (last post)
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question