Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 9th, 2004, 11:43 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Directing users

Hello to all,

I have a question in regards to directing user to a specific page after filling out information...
I have a form that validates fields and a radio button if chosen would determine which page the user would be directed..

I only have one problem and that is when i want to send them to the specific page, iam opening a new browser and I would like the user to be directed using the same window...

here is my code...


    if(form.notxt.checked){
        open('/page1.php');
        }else{
        open('/page2.php');
    }

what is the command to not open a new window but direct them in the same window to the either page...

thanks
--dungey
  #2 (permalink)  
Old March 9th, 2004, 12:46 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Not 100% sure I understand but try this:
Code:
 window.location.href  = (form.notxt.checked ? '/page1.php' : '/page2.php');
replace window with top if you are using frames and want to replace the whole frameset.
--

Joe
  #3 (permalink)  
Old March 9th, 2004, 04:18 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Joe,

Shouldn't it be

Code:
 window.location.href  = (form.notxt.checked)? '/page1.php' : '/page2.php';
?

Or does it work like this too?

----------
---Snib---
----------
  #4 (permalink)  
Old March 10th, 2004, 05:43 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I think thy're the same. You could remove all the parentheses, I just put them in for reader clarity.:)

--

Joe


Similar Threads
Thread Thread Starter Forum Replies Last Post
How many users.... rupen Classic ASP Basics 0 October 20th, 2006 08:45 AM
page directing sentme_mail HTML Code Clinic 7 November 22nd, 2004 03:21 PM
Help with redirecting users Sach Classic ASP Databases 1 January 16th, 2004 12:29 PM
Netbean users ....please help me out pratheeba Servlets 1 November 26th, 2003 01:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.