1 Replies - 2271 Views - Last Post: 12 September 2012 - 09:42 PM

#1 TLW97  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-September 12

onClick - link in same window

Posted 12 September 2012 - 09:12 PM

I have a module on a new site I am building using Dolphin that is a photo slider with text/links. Everything works wonderful except that this onclick opens the link in a new window and I want the link it points to to open in the same window.

Please tell me what I need to change in the below to make that happen? I have tried just using the link after onclick instead of window.open(this.href) but this did not work.

<script type="text/javascript" src="nivo-slider/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="nivo-slider/jquery.nivo.slider.js"></script>



<div id="wrapper">

<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">

<a  style="display:none;" onclick="window.open(this.href); return false;" href="/m/news/view/Futuristic-Dodge" ><!----Maximum---22-character-->
<img src="slider_img/toystory.jpg" alt="" title="" /><!----Maximum---22-character-->
<div class="txt" style="display:none;">
<h1 style="color:#ffffff">You Will Be Unprepared</h1><!----Maximum---22-character-->
A young girl is institutionalized by her wicked stepfather.Retreating <!----Maximum---50-character-->
to an alternative reality as a coping strategy, she envisions a plan<!----Maximum---50-character-->
which will help her escape from the facility. The lines between<!----Maximum---50-character-->
reality and fantasy blur as...<!----Maximum---35-character-->

</div>

</a>



<a style="display:none;" onclick="window.open(this.href); return false;" href="/m/news/view/Futuristic-Dodge" >
<div class="txt" style="display:none;">
<img src="slider_img/up.jpg" alt="" title="" />
<h1 style="color:#ffffff">Design of the future</h1><!----Maximum---22-character-->
The Tomahawk is a Viper V-10 based motorcycle,a 500 horsepower engine<!----Maximum---50-character-->
with four wheels beneath it. The engine breathes through twin throttle<!----Maximum---50-character--> 
bodies mounted right up front. The Tomahawk concept is an <!----Maximum---50-character-->
awesome-sounding machine. Clouds...<!----Maximum---35-character-->

</div>

</a>
               
			   
			   
			   



<a  style="display:none; "onclick="window.open(this.href); return false;" href="/m/news/view/Futuristic-Dodge" >
<div class="txt" style="display:none;">
<img src="slider_img/walle.jpg" alt="" />
<h1 style="color:#ffffff">Lelouch Of The Rebellion</h1><!----Maximum---22-character-->
The Empire of Brittania has invaded Japan using giant robot weapons <!----Maximum---50-character-->
called Knightmare Frames. Japan is now referred to as Area 11, and <!----Maximum---50-character-->
its people the 11s. A Brittanian who was living in Japan at the time,<!----Maximum---50-character-->
Lelouch, vowed to his Japanese friend...<!----Maximum---22-character-->

</div>
</a>
 
 
 
 
<a style="display:none;" onclick="window.open(this.href); return false;" href="/m/news/view/Futuristic-Dodge" >
<div class="txt" style="display:none;">
<img src="slider_img/nemo.jpg" alt="" rel="images/up.jpg" />
<h1 style="color:#ffffff">Paramore frontwoman</h1><!----Maximum---22-character-->
The singer said the band planned to hit the studio after returning from <!----Maximum---50-character-->
a South American tour this month. The new songs, set to arrive before a <!----Maximum---50-character-->
full album, are likely to include 'In The Mourning' which Williams <!----Maximum---50-character-->
recently debuted on her... <!----Maximum---35-character-->

</div>
</a>
 
 
 
 
           
		   
		   
</div></div></div>
        
			

	
			
			
			
<link rel="stylesheet" href="nivo-slider/default.css" type="text/css" media="screen" />	
<script type="text/javascript">
$(window).load(function() {
  $('#slider').nivoSlider();
    });
</script>	


	




Thank you in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: onClick - link in same window

#2 StefanOnRails  Icon User is offline

  • D.I.C Head

Reputation: 35
  • View blog
  • Posts: 105
  • Joined: 31-July 12

Re: onClick - link in same window

Posted 12 September 2012 - 09:42 PM

View PostTLW97, on 13 September 2012 - 06:12 AM, said:

I want the link it points to to open in the same window.

Well, by the default the link will target the current page, so if this is what you want to achieve I suggest just removing the onclick="..." attribute (you can also use window.location = this.href instead of "window.open(...)"). If not you can check the target attribute here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1