Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML command button setup

Status
Not open for further replies.

FoxT2

MIS
Oct 3, 2003
143
0
0
US
Hi,

I am working with a HTML page and am trying to get a command button to execute this string...

"<%= oProp.ScriptPath+[?action=thanks] %>"

I have tried it like this...
<INPUT id="Button1" type="button" value="Button" name="Button1" onclick="<%= oProp.ScriptPath+[?action=iepthanks] %>">

But it does not work.

In an example that I have it does work using a submit button like this..

<form name="theform" method="post" action="<%= oProp.ScriptPath+[?action=thanks] %>" ID="Form1">

<input type="submit" name="Submit" value="Submit" ID="Submit1" style="Z-INDEX: 104; LEFT: 592px; POSITION: absolute; TOP: 144px"></P>

But I really don't want to have to do it that way. Anyone know if this is possible to do?

Thanks,
FoxT
 
It looks like you're trying to mix uninterpreted ASP with HTML. If you're not running this through a web server of some kind, I'd guess it probably won't work.

Lee
 
You're mixing client-side code (javascript or vbscript) that can be executed by the browser with the server-side code that is run on the server. You cannot do that. You need to do it the way it is done in your latter example.
 
I think

Code:
<INPUT id="Button1" type="button" value="Button" name="Button1" onclick="location.href='<%= oProp.ScriptPath+[?action=iepthanks] %>'">

Is what you're looking for.

all i have added is the location.href=
the onclick attribute expects a javascript expression, and you were just passing it a url.

Hope it helps!

(Yes it is possible to mix client and server side scripts, ASP.NET web forms rely on it, and so does AJAX)
 
Nope. That's not the HTML output. Run the page through your web server, choose View, then Source, and copy and paste what you find THERE.

Lee
 
Yes I see what you mean, its referenicing the file on the filesystem, not over http.

The property you need to use is the "REQUEST_URI" http request header. not sure how in ASP mind.
 
Code:
<INPUT id="Button1" type="button" value="Button" name="Button1" onclick="location.href='<%=Request.ServerVariables("SCRIPT_NAME")%>'>
 
i Misseda bit:

Code:
<INPUT id="Button1" type="button" value="Button" name="Button1" onclick="location.href='<%=Request.ServerVariables("SCRIPT_NAME")+'?action=iepthanks'%>'>
 
BVecause he asked for a solution using the onClick="" attribute of the input element. As this attribute requires a javascript expression as its value, I added it in.
 
Thanks for the suggestions Andeee, I will see if I can get that to work.

FoxT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top