stop form action from opening window |
mazer 03-17-2006, 01:45 PM I have a free javascript that shows the results of the submited form in a pop-up window, but this isn't what I want, I want to stop the window from opening completely but I still want the form to submit the data, is there a way to do this? or could I just alter the current javascript to do this? I've just started using javascript in the last two days so please forgive my total lack of knowledge.
Here's the script and the form that I used
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// test variables
var myHeight = 200;
var isResizable = true;
function createTarget(form) {
_target = form.target;
_colon = _target.indexOf(":");
if(_colon != -1) {
form.target = _target.substring(0,_colon);
form.args = _target.substring(_colon+1);
} else if(typeof(form.args)=="undefined") {
form.args = "";
}
if(form.args.indexOf("{")!=-1) {
_args = form.args.split("{");
form.args = _args[0];
for(var i = 1; i < _args.length;i++) {
_args[i] = _args[i].split("}");
form.args += eval(_args[i][0]) + _args[i][1];
}
}
form.args = form.args.replace(/ /g,"");
_win = window.open('',form.target,form.args);
if(typeof(focus)=="function")
_win.focus();
return true;
}
// End -->
</script>
<form action="http://ww9.aitsafe.com/cf/add.cfm" method=get
target="_top;"
onSubmit="return createTarget(this);">
<input type="HIDDEN" name="userid" value="*******">
<input type="hidden" name="lg" value="0">
<INPUT TYPE="HIDDEN" NAME="return" VALUE="http://www.themazecomicstore.com/">
<input type="HIDDEN" name="price" value="<%=price%>">
<input type="HIDDEN" name="product" value="<%=details%>">
<input type="HIDDEN" name="units" value="<%=units%>">
<% If instock = 0 Then
Response.Write("<FONT COLOR=#FFFFFF>Out of Stock</FONT>")
Else
Response.Write("<INPUT TYPE=SUBMIT NAME=action VALUE='Add to Cart'>")
End If
%>
</FORM>
|
|
|
|
|