By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,080 Members | 1,748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,080 IT Pros & Developers. It's quick & easy.

Send a browser to a link with Javascript

P: n/a
How do you send a browser to a link when a command is given? I've
tried using Java Server Pages <jsp:forward /command but that doesn't
change the link in the address bar and some other problems arise with
it. A javascript method would work in what I'm doing but I don't know
what that command would be. Basically, when a button is pressed I want
some session data to be set and for a link to be followed.

Any ideas?

Jul 22 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Well I found one way just now but I don't think it will work. What I
tried was the following successful command in a javascript function:

document.location.href="index.html";

I think what I'm really wanting is for a form to be submitted to a
particular page. Let me explain further. I have 3 basic forms that
represent 3 object types. Object 2 has an object 1 and object 3 has an
object 2. So if I'm on a form for object 2 and I want to create a new
object 3 I would want to go to the object 3 form with the correct
object 2 value selected based on the previous form. I guess I could do
this with sesssion data but I'm unclear on that as well. How do I set
session data?

I also want the forms cancel button to revert the user back to the
previous form they were on. Here I'm thinking I will keep a list of
forms that have been visited and push and pop pages off that list as
the user navigates the forms. I can imagine doing this with session
data or with hidden input variables that I set at the bottom of the
form.

mcrave...@wright.edu wrote:
How do you send a browser to a link when a command is given? I've
tried using Java Server Pages <jsp:forward /command but that doesn't
change the link in the address bar and some other problems arise with
it. A javascript method would work in what I'm doing but I don't know
what that command would be. Basically, when a button is pressed I want
some session data to be set and for a link to be followed.

Any ideas?
Jul 22 '06 #2

P: n/a
What do you mean "command"?

I manage a wizard setup by creating a form with an empty action, and a
js function to set the action. The "previous" button sets the form
action to the previous page, the "next" button sets the form action to
the next action, "finish" to the last page, etc.

Jason

mc*******@wright.edu wrote:
Well I found one way just now but I don't think it will work. What I
tried was the following successful command in a javascript function:

document.location.href="index.html";

I think what I'm really wanting is for a form to be submitted to a
particular page. Let me explain further. I have 3 basic forms that
represent 3 object types. Object 2 has an object 1 and object 3 has an
object 2. So if I'm on a form for object 2 and I want to create a new
object 3 I would want to go to the object 3 form with the correct
object 2 value selected based on the previous form. I guess I could do
this with sesssion data but I'm unclear on that as well. How do I set
session data?

I also want the forms cancel button to revert the user back to the
previous form they were on. Here I'm thinking I will keep a list of
forms that have been visited and push and pop pages off that list as
the user navigates the forms. I can imagine doing this with session
data or with hidden input variables that I set at the bottom of the
form.

mcrave...@wright.edu wrote:
How do you send a browser to a link when a command is given? I've
tried using Java Server Pages <jsp:forward /command but that doesn't
change the link in the address bar and some other problems arise with
it. A javascript method would work in what I'm doing but I don't know
what that command would be. Basically, when a button is pressed I want
some session data to be set and for a link to be followed.

Any ideas?
Jul 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.