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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset Button in Javascript not working

Status
Not open for further replies.

AndyLord

Programmer
Jun 30, 2004
45
GB
Can anyone help, please.....
I have used the javascript ASPSimpleSearch - A Free ASP Search Engine, many thanks guys for providing this. It works a treat, with Frontpage 2002. I am trying to include a Reset button that will reset, funnily enough, teh text box and search results on the page. I have tried various methods, ways etc but cannot get it to work. The code was downloaded from the following site, The code for the page I'm trying to get working is:
#######################################################
<%@Language=JavaScript%>

<!--#include file="ass-engine.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ASPSimpleSearch</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="cache-control" content="no-cache">
<meta name="document-state" content="dynamic">
<meta name="robots" content="none">
<!--
// ASPSimpleSearch
// // Copyright (C) 2001,2002 Joel Coreson
-->
<!--#include file="ass-client-side.js.asp" -->
<link rel="stylesheet" type="text/css" href="ass-style.css">
<style fprolloverstyle>A:hover {color: #FF0000; font-style: italic; font-weight: bold}
</style>

</head>
<body vlink="#0000FF">

<form name="myform" action="searchNew.asp" method="GET" onsubmit="return isSearchTermValid( this );">
<b><font size="3">Enter search criteria: </font></b>
<input type="text" name="searchTerm" size="25" maxlength="35" value="<%=gobj_searchTerm.outputSafeTerm%>">
<input type="submit" name="Submit" value="Search">
<input type="button" name="reset" value="reset" onClick="return reset_form(this)"></form>


<%
//This function displays any error messages that occur.
writeMsg();

//This function displays the results
//Place this where ever you would like the results to be displayed.
displayResults();

function reset_form(myform)
{

document.myform.test.value = ""; document.myform.one.value = "one";
return (false);
}

%>

<p><a href=" border="0" src=" alt="Valid HTML 4.01!" height="31" width="88"></a></p>

</body>
</html>
###########################################################

Any help with this would be greatly appriciated. Cheers in advance.
 
i dont find a field called test or one...

Known is handfull, Unknown is worldfull
 
i dont find a field called test or one...

Known is handfull, Unknown is worldfull
 
Also, itlloks like you are putting javascript inside asp brackets. A javascript function needs to be in the html portion of the script inside script tags. Also, with the above this.form comment, you need to change the function to:

<script language ="javascript">
function reset_form(myform)
{

myform.test.value = ""; myform.one.value = "one";
return (false);
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top