I need help with onClick=

Discussion in 'Programming' started by joergermeister, Jan 2, 2009.

  1. #1
    Is it possible to make the following not open in new window?
    I added the onClick="window.open('onlinecv.php?section=Settings')". It does everything i need it to do, but i don't want it to open in new window and it does.

    <td align="center" colspan="2">
    <input name="submit" type="submit" value="Save Page" onClick="window.open('onlinecv.php?section=Settings')"/></td>
    </tr>
    </form>
    </table>
    Edit/Delete Message

    thanks, JP
     
    joergermeister, Jan 2, 2009 IP
  2. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use location instead of open
     
    fairuz.ismail, Jan 2, 2009 IP
  3. pushkar008

    pushkar008 Active Member

    Messages:
    91
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #3
    <td align="center" colspan="2">
    <input name="submit" type="submit" value="Save Page" onClick="window.location('onlinecv.php?section=Settings')"/></td>
     
    pushkar008, Jan 2, 2009 IP
  4. joergermeister

    joergermeister Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I tried it and i get an error saying object does not support this action
     
    joergermeister, Jan 2, 2009 IP
  5. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    the syntax is window.location='anewpagehere.html'
     
    fairuz.ismail, Jan 2, 2009 IP
  6. joergermeister

    joergermeister Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    as soon as i change the onclick line from what you see below, it gives me error. what you see now works but opens in new window and i don't want it in new window.

    <table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr>
    <td align="left" class="tcat">Online Application</td>
    </tr>
    <tr>
    <td align="left" valign="top" class="tborder">
    <?
    $q6 = "select * from content where lang = \"$lang\" and section = \"Jobseekers\" and title = \"Online CV\"";
    $r6 = mysql_query($q6) or die(mysql_error(Error5));
    $a6 = mysql_fetch_array($r6);

    echo "$a6[content]";
    ?>

    <table width="100%" border="0" cellspacing="0" cellpadding="5">
    <form method=post>
    <tr>
    <td valign="top" colspan="2">
    <hr style='background-color: rgb(204, 204, 204);' width='100%' size='1' noshade='noshade' color='#cccccc'>
    </td>
    </tr>
    <?
    if($message == "application saved")
    {
    echo "
    <tr>
    <td colspan='2' align='left'><font color='red'><b>$section updated. If you wish to update any other section of your Profile/Application, please click on the link to the relevant section. <a href='search.php'>Click here</a> to begin searching for a job.</b></font>
    </td>
    </tr>";
    }
    ?>


    <?
    if($section == "Career Objective")
    {
    ?>
    <tr>
    <td colspan="2" align="left">Enter a headline that will reflect your career. e.g. Results Oriented QA Specialist, Great Organiser</td>
    </tr>
    <tr>
    <td align="left" valign="top" width="30%">Headline:</td>
    <td align="left">
    <input type="text" name="headline" value="<?=$a7[headline]?>">
    </td>
    </tr>
    <tr>
    <td colspan="2" align="left">Please specify the goals you want to achieve in your life. Include your skills, area of interests and specialisations.</td>
    </tr>
    <tr>
    <td align="left" valign="top">Career Objective:</td>
    <td align="left"><textarea cols="45" rows="8" name="objective"><?=$a7[objective]?></textarea></td>
    </tr>
    <tr>
    <td colspan="2" valign="top">Please enter the earliest date you are available to work. (mm/dd/yyyy)</td>
    </tr>
    <tr>
    <td align="left" valign="top">Date:</td>
    <td align="left" valign="top"><input name="available" type="text" value="<?=$a7[available]?>"></td>
    </tr>
    <tr>
    <td align="left" valign="top">Are you willing to relocate:</td>
    <td align="left" valign="top">
    <?
    if($a7[relocate] == 'Yes')
    {
    echo "
    <input type=radio name=relocate value='Yes' checked>Yes
    <input type=radio name=relocate value='No'>No
    ";
    }
    else
    {
    echo "
    <input type=radio name=relocate value='Yes'>Yes
    <input type=radio name=relocate value='No' checked>No
    ";
    }
    ?>
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2"><input name="submit3" type="submit" value="Save Page" onclick="window.open('onlinecv.php?section=Settings')"/></td>
    </tr>
    </form>
    </table>


    thank you for your help everyone, JP
     
    joergermeister, Jan 3, 2009 IP
  7. Seraskier

    Seraskier Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    onclick="javascript:window.open('onlinecv.php?section=Settings');"

    or just to navigate to the new page, no new window

    onclick="javascript:window.location='onlinecv.php?section=Settings';"
     
    Seraskier, Jan 3, 2009 IP
  8. joergermeister

    joergermeister Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    That also did not work. Just saves page.
     
    joergermeister, Jan 4, 2009 IP
  9. joergermeister

    joergermeister Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Does anybody have more suggestions. I am pulling my hair out with this. I just want it to go to next page after submitting. Post #6 is the code i am trying to change
     
    joergermeister, Jan 7, 2009 IP
  10. mediashare

    mediashare Active Member

    Messages:
    200
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #10
    <td align="center" colspan="2">
    <A HREF = "onlinecv.php?section=Settings"
    onClick="return confirm('Save Setting ?')">
    <input name="submit3" type="submit" value="Save Page"/>
    </A>
     
    mediashare, Jan 7, 2009 IP