Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click radio button & open new window

Status
Not open for further replies.

sshelton5150

Programmer
Jan 3, 2007
5
US
I want my users to be able to click a radio button to open a new window. Right now, it doesn't open a new window it just goes to the URL right in the same browser window when they click on the radio button.

I'm calling a window.open function onClick, which I assumed would result in the URL opening in a new window like normal.

Is it not possible to use radio button clicks to open new windows? If so, what's the trick?

 
Without seeing what code you've done so far it's pretty much impossible to tell you what you're doing wrong.

Here's a minimalist example of a radio button that opens up google in a new window when clicked. It work fine in both IE and FF so I'm not sure what could be wrong with your code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
[purple]<script type="text/javascript">
function blah() {
   var a = window.open("[URL unfurl="true"]http://www.google.com");[/URL]
}
</script>[/purple]
<style type="text/css"></style>
</head>
<body>

<input type="radio" [purple]onclick="blah()"[/purple] />Click me

</body>
</html>

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
I think I just had a syntax error in mine. I switched it around to your code and it works perfectly. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top