0

Hi guys,

I am new to javascript so thought I's post here for some advice.

I'm trying to complete a simple keyword search where the keyword is forwarded on the end of a url. I have this working-(ish), but at the moment it's doing this:

1. Add keyword and hit send
2. Opens a new window to confirm search term.
3. Clicking that sends you to the target site with keyword on the end.

I'm trying to bypass stage 2 and go straight to 3 from step 1.

Code so far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>



<SCRIPT LANGUAGE="JavaScript">

function searchFunc() {

var newWindow = window.open("about:blank", "searchValue");

var searchValue = document.search.queryField.value;

var keywordSearch = document.search.keyword.value;

newWindow.document.write("<a href='" + keywordSearch + searchValue + "' target = 'blank'>Confirm Search</a>\n");

}

</script>





</head>



<body>

<form name=search>

<input type=hidden name=keyword value="http://www.domain.com/default.aspx?st=FT&ss=">

<input type=text size=25 name="queryField">

<input type=button value="Search" onClick="searchFunc()">

</form>



</body>

</html>

I've tried deleting some of the code but always lose functionality. Any advice?

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by fluffybunny69
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.