Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 20th Dec 2014, 02:29 AM   #1
New Warrior Member
 
Join Date: 2014
Location: Ludhiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Need a onclick Script
Share on: 
fb share twitter share gplus share more share

I need a onclick script for my site, i want that when somebody click on my page a new site get open in new window.
navi009 is offline  
Unread 20th Dec 2014, 06:04 AM   #2
Active Warrior
Registered Member
 
Join Date: 2013
Posts: 58
Thanks: 4
Thanked 16 Times in 12 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

HTML Code:
<html>
        <head>
	        <title>Simple OnClick Script</title>
        </head>
        <body>
                Please click...


                <script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
                <script type="text/javascript">
	                $("body").on("click", function() {
		                window.open("https://kindlebookspromotion.com", "_blank");
	                });
                </script>
        </body>
</html>
geekSoftware is offline  
The Following 2 Users Say Thank You to geekSoftware For This Useful Post:
Unread 20th Dec 2014, 10:16 AM   #3
WordPress Corecontributor
 
Join Date: 2014
Location: Alabama
Posts: 75
Thanks: 85
Thanked 25 Times in 21 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Originally Posted by geekSoftware View Post

HTML Code:
<html>
        <head>
            <title>Simple OnClick Script</title>
        </head>
        <body>
                Please click...


                <script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
                <script type="text/javascript">
                    $("body").on("click", function() {
                        window.open("https://kindlebookspromotion.com", "_blank");
                    });
                </script>
        </body>
</html>
Yeah, that's pretty much it. I would have put the jQuery load in the html head, but that does what the OP asks.
BDazzler is offline  
The Following User Says Thank You to BDazzler For This Useful Post:
Unread 20th Dec 2014, 11:38 AM   #4
Warrior Member
 
Join Date: 2014
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Originally Posted by BDazzler View Post

Yeah, that's pretty much it. I would have put the jQuery load in the html head, but that does what the OP asks.

The best way to implement is put the jquery on bottom and put, you page will load first and last jquery will load, the effect will be the same, but your seo score will be a bit higher.
And the user experience goes up

$(document).ready(function(){
$("body").on("click", function() {
window.open("https://kindlebookspromotion.com", "_blank");
});
});

xerious is offline  
The Following User Says Thank You to xerious For This Useful Post:
Unread 22nd Dec 2014, 02:22 AM   #5
New Warrior Member
 
Join Date: 2014
Location: Ludhiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Thanks a lot guys, its working perfectly, now i hope i will earn some extra money too.
navi009 is offline  
Unread 22nd Dec 2014, 02:24 AM   #6
New Warrior Member
 
Join Date: 2014
Location: Ludhiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

xerious thanks for your valuable advice.
navi009 is offline  
Unread 22nd Dec 2014, 02:40 AM   #7
New Warrior Member
 
Join Date: 2014
Location: Ludhiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Guys, i need one improvement in this script, i wanna visitors to remain on my site,
now what happened when visitors click on my site a new windows open and they automatically leave my site.
navi009 is offline  
Unread 22nd Dec 2014, 11:14 PM   #8
New Warrior Member
 
Join Date: 2014
Location: Ludhiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Guys, i need one improvement in this script, i wanna visitors to remain on my site,
now what happened when visitors click on my site a new windows open and they automatically leave my site.
navi009 is offline  
Unread 23rd Dec 2014, 12:23 AM   #9
Conceited Know-It-All
 
kilgore's Avatar
 
Join Date: 2014
Location: Amurrica
Posts: 952
Thanks: 465
Thanked 1,136 Times in 503 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Why not just do something like this?

Code:
<a href="http://www.example.com" rel="nofollow" target="_blank">Link text</a>
Edit You'll see a rel="nofollow" above which WF is apparently adding automatically. You can include (or exclude) that part as you see fit.


Last edited on 23rd Dec 2014 at 12:25 AM. Reason: Clarification
kilgore is offline  
Unread 26th Dec 2014, 12:37 PM   #10
New Warrior Member
 
Join Date: 2014
Location: Ludhiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Need a onclick Script
Share on: 
fb share twitter share gplus share more share

Thanks for reply, but i need a onclick window and visitors remain on my site.
navi009 is offline  
Closed Thread


Bookmarks

Tags
onclick, script


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 09:54 PM.