SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Jun 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Open in another window

    How to open one page in new window and another in same window using radio button.

    Code:
    <FORM NAME="example" class="frm" onreset="disableField()" target=_blank onSubmit="return checkForm(this);" action="a.php">
    There are 4 radio buttons I have to open option 4 in another page and option 1,2,3 in same window

  2. #2
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I assume you're asking how to do this?

    Sounds like you need a little client-side javascript or something similar that changes the target and href attributes of your link dynamically based on the value of your radio button fields.

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi sandy!

    I think you are not clear about the problems. Do you want to open a new popup window upon click radio button? If so try something like this:
    HTML Code:
    <input type="radio" name="rdoBtn" id="rdoBtn" value="1" onClick="window.open('filename_to_open_in_new_window.php?id=' + this.value, 'NW', 'width=300,height=400');" />
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  4. #4
    SitePoint Addict
    Join Date
    Jun 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rajug View Post
    Hi sandy!

    I think you are not clear about the problems. Do you want to open a new popup window upon click radio button? If so try something like this:
    HTML Code:
    <input type="radio" name="rdoBtn" id="rdoBtn" value="1" onClick="window.open('filename_to_open_in_new_window.php?id=' + this.value, 'NW', 'width=300,height=400');" />

    If I use this code when I click on the option 1 then, blank page opens. If I use onSubmit then it doesnot open in new window.
    I have removed target=_blank in the form tag.

    So please help me

  5. #5
    SitePoint Guru SSJ's Avatar
    Join Date
    Jan 2007
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the following logic:

    Call a Javascript function on onSubmit event:
    Onsubmit="javascriptpenWindow()";
    Write a window.open code in Javascript function:
    function openWindow(){
    window.open('filename_to_open_in_new_window.php?id=' + this.value, 'NW', 'width=300,height=400');
    }
    Hope this helps..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •