The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Code to open in new window?

2 posters

Go down

Code to open in new window? Empty Code to open in new window?

Post by WatchfulShadow August 6th 2012, 7:30 pm

I have a clickable on my forum, but the link opens in the same window, how do I open in a new window?

I have a clickable image that opens in a new window, but I can't seem to find what the code is that's making it do that.
avatar
WatchfulShadow
New Member

Posts : 22
Reputation : 3
Language : English

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by Sanket August 6th 2012, 7:32 pm

What code did you add?
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by WatchfulShadow August 6th 2012, 7:36 pm

The code is from the Social Widget...

Code:
<div class="twitter takip" onclick="location.href='http://www.twitter.com/'">
                </div>
avatar
WatchfulShadow
New Member

Posts : 22
Reputation : 3
Language : English

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by Sanket August 6th 2012, 7:43 pm

Code:
<div class="twitter takip" onclick="window.open='http://www.twitter.com/'">
                </div>
I don't know if it will work though.

Are you just adding a image link since you have its css somewhere else?
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by WatchfulShadow August 6th 2012, 7:48 pm

Didn't work.

I have everything set, the links for the images work. The only problem is I don't know how to make them open in a new window on click.
avatar
WatchfulShadow
New Member

Posts : 22
Reputation : 3
Language : English

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by Sanket August 6th 2012, 7:52 pm

Where have you added this?
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by WatchfulShadow August 6th 2012, 8:01 pm

The links to the websites are in a Javascript and also a Widget. I am not the founder of my forum, so this was the only (I think) way to make this work. This is supposed to be done under the 'Templates' section, but as I said, I am not the founder so I do not have access to this. I had to make this into a widget for it to work.

Like I said, everything works fine. Apart from this little problem.

I replaced the original link with the one you provided, didn't work.
avatar
WatchfulShadow
New Member

Posts : 22
Reputation : 3
Language : English

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by Sanket August 6th 2012, 8:05 pm

Such a easy html code could work in a widget.
Code:
<a href="http://hitskin.com" target="_blank"><img src="http://i62.servimg.com/u/f62/11/22/70/40/fmfire10.png" border="none"></a>
Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by WatchfulShadow August 6th 2012, 8:37 pm

Didn't help.

This is the full code in the Widget...

Code:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
            <title>Social Media Buttons</title>
            <script src="dkthemes.forumotions.in/38797.js" type="text/javascript"></script>
            <script type="text/javascript">
            $(document).ready(function(){
            $(".takip").mouseover(function(){
                  $(this).filter(':not(:animated)').animate({width:135},{duration:500});
            });
            $(".takip").mouseout(function(){
                $(this).animate({width:42});
            });
            });
            </script>
         
         
            <div id="takip">
                <div class="facebook takip" onclick="location.href='http://www.facebook.com'">
                </div>  <div class="twitter takip" onclick="location.href='http://www.twitter.com/'">
                </div>
                <div class="Youtube takip" onclick="location.href='http://www.youtube.com'">
                </div>

If you want to see what it does as it is, go to http://brothersofpain.forumotion.com/ You'll see the images on the left. I want them to open in a new window.

If you want the code from the Javascript, let me know.
avatar
WatchfulShadow
New Member

Posts : 22
Reputation : 3
Language : English

Back to top Go down

Code to open in new window? Empty Re: Code to open in new window?

Post by WatchfulShadow August 6th 2012, 9:53 pm

Rideem3 wrote:Why are you using JavaScript to open new pages when you can use HTML?

Code:
<a href="URLHERE" target="_blank">Some Text</a>

So how am I supposed to do it?
avatar
WatchfulShadow
New Member

Posts : 22
Reputation : 3
Language : English

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum