Charles Marsh
Charles Marsh

Reputation: 465

Javascript select boxes based on previous selection

How can I ensure that this does NOT open in a new window??

onclick="ob=this.form.table;window.open(ob.options[ob.selectedIndex].value)"/>

Upvotes: 1

Views: 229

Answers (3)

Hojo
Hojo

Reputation: 935

if you want it open in a same window you need to write

onclick="ob=this.form.table;window.location.href=(ob.options[ob.selectedIndex].value)"/>

Upvotes: 1

Prutswonder
Prutswonder

Reputation: 10064

You should replace it with:

onclick="ob=this.form.table;document.location=ob.options[ob.selectedIndex].value;"/>

Window.open() opens a new window; document.location changes the page in the current window.

Upvotes: 1

Gabe
Gabe

Reputation: 50493

Do you want it to open in the same window?

if so use window.location

Upvotes: 0

Related Questions