Aaron,
The problems I describe with JavaScript are not meant to imply that you
cannot use JavaScript without issue, indeed many web sites do. My point is
that it relies upon capabilities of the client that may be unsupported or
disabled. Therefore, *if* there is a way to avoid it by giving control to
the server over the client, it should be taken.
Whereas I believe you that you have never seen any problems, I am confident
that this is because you haven't *looked* for problems and that I could
break your web page in a number of ways:
- Disable JavaScript (as a paranoid user would).
- Use a browser that does not support JavaScript (as some users resistant to
change may still do).
- Use various versions of Internet Explorer and Netscape/Mozilla until I
find one that does not understand your DOM syntax.
Originally, you said that you "have a page that posts back to itself". That
is why I didn't understand the need to change the action. But now you say
"I've got links on my page that I want to use to execute specific
functions". I don't follow exactly what this means without seeing it, but I
imagine that you could avoid JavaScript by including hidden fields in forms
(as I described) and/or parameters in URLs used by links. The page would
always post to itself, but the parameters in the form or URL would dictate
where it should redirect to. All functions could be in the same ASP or in a
function from a file included in the ASP using #include. If you have IIS 5
or higher, you can transfer execution to another ASP using Server.Transfer
if you have a version of IIS that supports it, which you probably do. If you
don't, you can use Response.Redirect, which relies on the client too but to
a much lesser extent and in a way that is compatible with even the oldest of
browsers and that cannot be turned off with configuration in any browser
that I know of.
I don't feel I can give a proper balanced answer to your questions without
raising these issues with you. If you choose not to do anything about them,
that's your choice. As you imply, that is not the root cause of your
problem.
You didn't answer my question about this line. I think this line is the root
cause of the problem:
document.logic_form.action = '<%= webroot %>/Secure/SaveBuild.asp?cmd=1'
The value you are setting action to must be a URL, and may be a relative
URL. The value actually used will depend on the webroot variable. What is
the webroot variable and what is it set to? Look at the HTML source and see
what it says?
For example, if webroot is C:\inetpub\test then your HTML is:
document.logic_form.action = 'C:\inetpub\test/Secure/SaveBuild.asp?cmd=1'
Now suppose the URL was
http://myserver.com/test.asp. Then the URL it is
posting to is
http://myserver.com/test.aspC:\inetpub\test/Secure/SaveBuild.asp?cmd=1. That
can't be right!
Paul