New to javascript please help me create a link after we click on submit button
What is happening is when we click on submit button, it directly does the action on query to google
But instead need this to create a link
I mean when we hit search the javascript has to create a link and not query google
When we click on the link it should query google and not before that

Any solution please advice

<html>
<title> </title>
<head>
<script type="text/javascript">

var refine="resume"
var elim="-job"
function google(hit){
hit.q.value= hit.qfront.value+" "+refine+" "+elim

}

</script>

</head>
<body>
<form action="http://www.google.com/search" method="get" onSubmit="google(this)"/>
<p>PureSearch<br />
<input name="q" type="hidden" />
<input name="qfront" type="text" style="width: 180px" /> <input type="submit" value="Search" /></p>
</form>
</body>
</html>

This should be posted in the Javascript category.

However, you're javascript is requesting the Value of the hidden text box yet you have no value attribute... this will cause a java error.

You should use a return value to ensure that the form doesnt get sumbitted through to google. There are much better ways of doing something like this - i'm not sure what your trying to achieve by making someone type a query, click a button for it to then create a link.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.