AboutAnthony Levensalor Experience I have been programming in Java and Javascript since 1998. I run a web development company that specializes in Ajax front ends with PHP/MySQL back ends. I am a Sun Certified Java 2 Developer, and have done nothing but web applications for the last two years in my business
Past/Present clients Monster.com, Compuware Corporation, Flextronics International, Pragmatech Software, Open Travel Software, The Loss Mitigation Institute, Raw Story Media, Page One News Media.
Expert: Anthony Levensalor Date: 11/29/2007 Subject: Radio button with link in new windows
Question Dear Anthony,
I would like my radio button to link in a new window, can you tell me how to modify the script?
<input type="radio" name="1" value="1" onclick="javascript:parent.location.href='mylink';return false;">
Answer Sure thing. The trouble you're running into here is that the method you're using sets the location of the current window, and there is preciesly no way that I know of to make it open in a new one with window.location.
We are given, however, by the great and wise W3C peeps, a way to open a new window. Looks like this:
window.open("url", null, "options");
Where
url is where you want to go, null doesn't matter, and "options" is one of many different things.
If I wanted to open a new window like you're talking about, I think it sould probably be just like the one we're in now, so I'd call it like this: