user2157989
user2157989

Reputation: 23

Onclick refresh then href with the same click?

I need a little help. I went div crazy on my site using a toggle class to hide and the divs in the middle of the page. Well a couple things first the website http://gregedisonproductions.com

The first is if you click on things eventually especially on the leftsidebar they don't switch, and a bigger problem is if I'm watching a video from the leftsidebar and a play another one, it switch's but the audio keeps playing.

I was thinking that if the user clicked on anything, it would refresh the page, then execute the href command.

Can anyone help me in this area?

Upvotes: 3

Views: 33759

Answers (2)

Mollo
Mollo

Reputation: 723

If you want to redirect the URL, just add this to your onclick event, using PHP:

header("Location: http://yourpage.com/"); // add your URL  
exit;

Using Javascrip:

window.parent.location = "http://yourpage.com/";

Upvotes: 0

aug
aug

Reputation: 11714

If you want to reload the page with href, you can try this

<a href="#" onClick="window.location.reload();return false;">Reload</a>

Your problem though involves the fact that when you click on another video, it doesn't stop the original one; it simply hides it. Youtube has an API that allows you to stop the video through javascript though. I believe to pause a video you can do a pauseVideo with the API.

Upvotes: 11

Related Questions