User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,183 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,691 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1412 | Replies: 2
Reply
Join Date: Dec 2007
Posts: 4
Reputation: jenjen02 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jenjen02 jenjen02 is offline Offline
Newbie Poster

Image flip w/ link

  #1  
Dec 3rd, 2007
I've been having some problems with a little piece of Javascript. I am completely new to the language, so bear with me. What the end goal is to have a few link on the left side of a table, when the user hovers over them, there will be a thumbnail image on the right hand side that appears. This I have using this code:

<script type="text/javascript" language="javascript">
function showPic (whichpic) { 
	if (document.getElementById) { 
		document.getElementById('placeholder').src = whichpic.href; 
		return false; 
	} else { 
		return true; 
	} 
}
</script>

but I also want that when a user clicks on the actual link, it will bring them to another webpage. Any help would be great!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 56
Reputation: innovativeatul is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
innovativeatul's Avatar
innovativeatul innovativeatul is offline Offline
Junior Poster in Training

Re: Image flip w/ link

  #2  
Dec 4th, 2007
<A HREF="javascript:void(0)"
onclick="window.open('URL')">
CLICK HERE TO OPEN NEW WINDOW</A>

IN THIS WAY YOU CAN EASILY OPEN A NEW WINDOW AT THE SAME TIME WHEN USER CLICK ON THE LINK
Last edited by innovativeatul : Dec 4th, 2007 at 5:35 am. Reason: MISTAKE IN TYPING
Reply With Quote  
Join Date: Dec 2007
Posts: 4
Reputation: jenjen02 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jenjen02 jenjen02 is offline Offline
Newbie Poster

Re: Image flip w/ link

  #3  
Dec 4th, 2007
That worked sorta great!

I have it now where it shows the image on the mouseover, and when you click on the link, it brings up the web page in a new window, but unfortunately it also brings up the image since the a href is linked to the image. I wasn't sure if doing the A HREF="javascript:void(0)" would work because there is no reference to what image to show.

This is the code that I have for the link:

<a onmouseover="return showPic(this)" href="images/allservice.jpg" onclick="window.open('www.webpage.com')">Link Goes Here</a>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 7:56 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC