Right before you open the window, this should work
You may need to do some regular expressions in case they put in multiple spaces though.
if (myQuery){
myQuery = myQuery.replace(' ','+');
window.open(myQuery,"newwin");
return false;
}
-----Original Message-----
From: Greg Luce [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 12:12 PM
To: CF-Talk
Subject: RE: Web Search NS Error
Seth, you rock! The only problem left is when you enter 2 words in the
form. It looks like this in the url:
http://www.google.com/search?q=hotel Chicago, when it needs to have a +
between the search words. Do you see a good place to parse that into the
search string?
-----Original Message-----
From: Turetsky, Seth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 11:57 AM
To: CF-Talk
Subject: RE: Web Search NS Error
The js code to set MySearcher in the processSearch function looks off:
mySearcher = formObj.tosearch.value;
change to:
mySearcher = formObj.tosearch[formObj.tosearch.selectedIndex].value;
If that did work in IE, I guess IE doesn't require the selectedIndex to
get the selected item in a dropdown.
-----Original Message-----
From: Greg Luce [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 11:32 AM
To: CF-Talk
Subject: Web Search NS Error
I have a search form on a page that uses js (which I didn't write) to
call a new window using whichever search engine was selected. Anyone
have any ideas why it won't work with Netscape 4.7? It calls up a new
window with a 405 error. I may just do it with CF for Nutscrape. Here's
the code:
<script language="javascript">
<!-- shields up!
var isIE = false;
if (parseInt(navigator.appVersion) >= 4) {
if (navigator.appName == "Netscape")
{
} else {
isIE = true;
}
}
/* Begin Kill Nesting */
setTimeout ("changePage()", 3000);
function changePage() {
if (self.parent.frames.length != 0)
self.parent.location=document.location;
}
/* End Kill Nesting */
/*yummy.... Cookies*/
function setCookie(name,value,expires,path,domain,secure){
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
function DeleteCookie(name,path,domain){
if(getCookie(name)){
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 27-Sep-74 12:32:01 GMT";
}
}
function processSearch()
{
formObj = document.internetsearch;
mySearcher = formObj.tosearch.value;
mySearch = formObj.search.value;
var searchSite;
switch (mySearcher)
{
case "google":
searchSite = 'http://www.google.com';
myQuery ='http://www.google.com/search?q='+mySearch;
break;
case "yahoo":
searchSite = 'http://www.yahoo.com';
myQuery ='http://search.yahoo.com/bin/search?p='+mySearch;
break;
case "dogpile":
searchSite = 'http://www.dogpile.com';
myQuery
='http://search.dogpile.com/texis/search?q='+mySearch+'&geo=no&fs=web';
break;
case "mamma":
searchSite = 'http://www.mamma.com';
myQuery
='http://www.mamma.com/Mamma?query='+mySearch+'&qtype=0';
break;
case "altavista":
searchSite = 'http://www.altavista.com';
myQuery
='http://altavista.com/sites/search/web?q='+mySearch+'&pg=q&kl=XX';
break;
case "lycos":
searchSite = 'http://www.lycos.com';
myQuery
='http://search.lycos.com/main/default.asp?lpv=1&loc=searchhp&query='+my
Search;
break;
case "infoseek":
searchSite = 'http://www.infoseek.com';
myQuery
='http://www.overture.com/d/search/p/go/?Partner=go_home&Keywords='+mySe
arch+'&Go=Search&input=';
break;
case "metacrawler":
searchSite = 'http://www.metacrawler.com';
myQuery
='http://search.metacrawler.com/crawler?general='+mySearch+'&method=0&re
direct=&rpp &hpe®ion=0&timeout=0&sort=0&theme=classic';
break;
case "webcrawler":
searchSite = 'http://www.webcrawler.com';
myQuery
='http://search.excite.com/search.gw?c=web&lk=webcrawler&onload=&s='+myS
earch;
break;
case "excite":
searchSite = 'http://www.excite.com';
myQuery
='http://search.excite.com/search.gw?c=web&search='+mySearch;
break;
default:
myQuery ='';
}
var now = new Date();
now.setTime(now.getTime() + (365 * 24 * 60 * 1000));
setCookie("lastSearch", mySearch, now, "/");
var now = new Date();
now.setTime(now.getTime() + (365 * 24 * 60 * 1000));
setCookie("mySearcher", mySearcher, now, "/");
if (mySearch == "") {
window.open(searchSite);
return false;
}
if (myQuery){
window.open(myQuery);
return false;
}
else
{
return true;
}
}
function setSearchCookie()
{
formObj = document.internetsearch;
mySearcher = formObj.tosearch.value;
mySearch = formObj.search.value;
var now = new Date();
now.setTime(now.getTime() + (365 * 24 * 60 * 1000));
setCookie("mySearcher", mySearcher, now, "/");
}
-->
</script>
<table width="195" border="0" cellspacing="0" cellpadding="0">
<cfform name="internetsearch" method="post" onSubmit="return
processSearch()" action="">
<tr>
<td width="142" class="arial_10">Type your keyword or
phrase then press 'GO'</td>
<td height="28"><input type="image" border="0"
name="search_go" src="images/go.gif" width="26" height="28"
alt="go"></td>
</tr>
<tr>
<td colspan="2">
<cfif browser eq "NS">
<cfinput type="Text" name="search"
message="You must enter Keyword or Phrase to search" required="Yes"
size="8" style="font-family: Verdana; font-size: x-small;">
<cfelse>
<cfinput type="Text" name="search"
message="You must enter Keyword or Phrase to search" required="Yes"
size="15" style="font-family: Verdana; font-size: xx-small;">
</cfif>
<cfselect name="tosearch" onChange="setSearchCookie()"
style="font-family: Verdana; font-size: xx-small;">
<option value='altavista'>Alta Vista</option>
<option value='dogpile'>DogPile</option>
<option value='excite'>Excite</option>
<option value='google' Selected>Google</option>
<option value='infoseek'>InfoSeek</option>
<option value='lycos'>Lycos</option>
<option value='mamma'>Mamma</option>
<option value='metacrawler'>MetaCrawler</option>
<option value='webcrawler'>WebCrawler</option>
<option value='yahoo'>Yahoo</option>
</cfselect>
<!--- <input type="text" class="arial_10" name="search"
size="40"> --->
</td>
</tr>
</cfform>
</table>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists