Shap
Shap

Reputation: 1

javascript and thickbox

I have a thickbox appearing and have created a button which points to a new URL. I want it to work in the following way: 1. Click the button 2. Close the thickbox 3. Set parent window to new url.

I have succeeded in closing the thickbox but cannot get it to open the new url. The code I'm using is as follows: a onclick="javascript:self.parent.tb_remove(); parent.location.href=(this).href(www.google.com.au)"

Cheers,

Shap

Upvotes: 0

Views: 958

Answers (2)

Paul Alexander
Paul Alexander

Reputation: 32367

this in the context of a javascript event handler refers to the actual element itself. So you're basically setting the href attribute of the element itself. You want to set the location of the window as @nvl points out, so that would be

window.parent.location.href = "http://www.google.com.au";

Upvotes: 0

N 1.1
N 1.1

Reputation: 12534

window.location.href = "http://www.google.com.au"

Upvotes: 1

Related Questions