/    Sign up×
Community /Pin to ProfileBookmark

Can someone fix this up?

Hi,

I am a enough of a newbie at Javascript to know that I would not be able to fix this so I’m turning to this site and it’s wonderful (I hope) members to help, please.

I am creating a search application for the PSP (Playstation Portable) that can search multiple sites and use the define and site features (This is what I need help on).

I had the app ready and working with the search, but as soon as I tryed to add the features to it, it really messed up so PLEASE HELP ME ? !

Here’s the code:

[CODE]<html>
<head>
<style type=”text/css”>
<!–
.BlueSearch {
background-color: #C79B61;
border-width: 0;
}
–>
</style>
<title>Del-Search – The Eleven-In-One Search!</title></head>

<body>
<div style=”position: absolute; left: 0; top: 0; width: 480px; height: 272px; z-index: 0; background-color: #C79B61; layer-background-color: #C79B61; border: 1px none #000000;”>
<script language=”JavaScript”>
function startFeature(){
searchFeature = document.searchForm.searchText.value;
if(searchFeature != “”){
searchFeature = document.searchForm.whichFeature.selectedIndex + 1;
finalSearchString = “”;

if(searchFeature == 1){
finalSearchFeature = “”;
}
if(searchFeature == 2){
finalSearchFeature = “Define: “;
}
if(searchFeature == 3){
finalSearchFeature = “Site: “;
}

location.href = finalSearchFeature;
}
}
function startSearch(){
searchString = document.searchForm.searchText.value;
if(searchString != “”){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = “”;

if(searchEngine == 1){
finalSearchString = “http://www.google.com/search?sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8&q=” + startFeature + “” + searchString;
}
if(searchEngine == 2){
finalSearchString = “http://www.altavista.com/web/results?itag=ody&q=” + startFeature + “” + searchString + “&kgs=1&kls=0”;
}
if(searchEngine == 3){
finalSearchString = “http://search.yahoo.com/search?p=” + startFeature + “” + searchString + “&fr=yfp-t-500&toggle=1&cop=mss&ei=UTF-8”;
}
if(searchEngine == 4){
finalSearchString = “http://msxml.excite.com/info.xcite/search/web/” + startFeature + “” + searchString;
}
if(searchEngine == 5){
finalSearchString = “http://www.hotbot.com/index.php?nil_suggest=btn&ps=&loc=searchbox&tab=web&mode=search&currProv=msn&query=” + startFeature() + “” + searchString;
}
if(searchEngine == 6){
finalSearchString = “http://search.yahoo.com/search?ei=UTF-8&trackingType=go_search_home&p=” + startFeature + “” + searchString + “&fr=hsusgo1”;
}
if(searchEngine == 7){
finalSearchString = “http://search.lycos.com/?query=” + startFeature + “” + searchString;
}
if(searchEngine == 8){
finalSearchString = “http://search.aol.com/aolcom/search?invocationType=topsearchbox.webhome&query=” + startFeature + “” + searchString;
}
if(searchEngine == 9){
finalSearchString = “http://www.dogpile.com/info.dogpl/search/web/” + startFeature + “” + searchString + “/1/-/1/-/-/-/1/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/417/top/-/-/-/1”;
}
if(searchEngine == 10){
finalSearchString = “http://search.live.com/results.aspx?q=” + startFeature + “” + searchString + “&mkt=en-gb&FORM=LVSP”;
}
if(searchEngine == 11){
finalSearchString = “http://www.ask.com/web?q=” + startFeature + “” + searchString + “&qsrc=0&o=312&l=dir&dm=all”;
}

location.href = finalSearchString;
}
}
</script>

<basefont face=”Verdana, Arial, sans-serif”>

<form name=”searchForm”>

<table width=480 height=”272″ border cellpadding=0 cellspacing=0 bgcolor=#C79B61 style=.BlueSearch>

<tr>
<td height=”164″ rowspan=”3″ bgcolor=#C79B61 class=”BlueSearch”><img src=”DelSearchMain.png” width=”344″ height=”164″>
<td height=”2″ colspan=”6″ bgcolor=#C79B61 class=”BlueSearch”>
<tr>
<td height=”71″ colspan=”6″ bgcolor=#C79B61 class=”BlueSearch”>Feature:
<tr>
<td height=”48″ colspan=”6″ bgcolor=#C79B61 class=”BlueSearch”><label>
<select style=”background: dddddd” name=”whichFeature”>
<option value=”” selected>None</option>
<option value=”define: “>Define</option>
<option value=”site: “>Site</option>
</select>
</label>
<tr>
<td height=”53″ bgcolor=#C79B61 class=”BlueSearch”>Search term:
<td bgcolor=#C79B61 class=”BlueSearch”>Search using:
<td colspan=”5″ bgcolor=#C79B61 class=”BlueSearch”>
<tr class=”BlueSearch”>
<td bgcolor=#C79B61 class=”BlueSearch”><input style=”background: dddddd” name=”searchText” type=”text”>
<td bgcolor=#C79B61 class=”BlueSearch”>
<select style=”background: dddddd” name=”whichEngine”>
<option selected>Google
<option>Altavista
<option>Yahoo!
<option>Excite
<option>Hotbot
<option>Infoseek
<option>Lycos
<option>AOL Netfind
<option>Dogpile
<option>Windows Live
<option>Ask Jeeves
</select>
<td bgcolor=#C79B61 class=”BlueSearch”><input type=”button” value=”Send” onClick=”startSearch()”>
</table>
</form>
</div>
</body>
</html>[/CODE]

Thanks in advance!

EDIT: I reckone I should just put the original, non-messed up version up here too…

[CODE]<html>
<head>
<style type=”text/css”>
<!–
.BlueSearch {
background-color: #C79B61;
border-width: 0;
}
–>
</style>
<title>Del-Search – The Eleven-In-One Search!</title></head>

<body>
<div style=”position: absolute; left: 0; top: 0; width: 480px; height: 272px; z-index: 0; background-color: #C79B61; layer-background-color: #C79B61; border: 1px none #000000;”>
<script language=”JavaScript”>
function startSearch(){
searchString = document.searchForm.searchText.value;
if(searchString != “”){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = “”;

if(searchEngine == 1){
finalSearchString = “http://www.google.com/search?sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8&q=” + searchString;
}
if(searchEngine == 2){
finalSearchString = “http://www.altavista.com/web/results?itag=ody&q=” + searchString + “&kgs=1&kls=0”;
}
if(searchEngine == 3){
finalSearchString = “http://search.yahoo.com/search?p=” + searchString + “&fr=yfp-t-500&toggle=1&cop=mss&ei=UTF-8”;
}
if(searchEngine == 4){
finalSearchString = “http://msxml.excite.com/info.xcite/search/web/” + searchString;
}
if(searchEngine == 5){
finalSearchString = “http://www.hotbot.com/index.php?nil_suggest=btn&ps=&loc=searchbox&tab=web&mode=search&currProv=msn&query=” + searchString;
}
if(searchEngine == 6){
finalSearchString = “http://search.yahoo.com/search?ei=UTF-8&trackingType=go_search_home&p=” + searchString + “&fr=hsusgo1”;
}
if(searchEngine == 7){
finalSearchString = “http://search.lycos.com/?query=” + searchString;
}
if(searchEngine == 8){
finalSearchString = “http://search.aol.com/aolcom/search?invocationType=topsearchbox.webhome&query=” + searchString;
}
if(searchEngine == 9){
finalSearchString = “http://www.dogpile.com/info.dogpl/search/web/” + searchString + “/1/-/1/-/-/-/1/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/417/top/-/-/-/1”;
}
if(searchEngine == 10){
finalSearchString = “http://search.live.com/results.aspx?q=” + searchString + “&mkt=en-gb&FORM=LVSP”;
}
if(searchEngine == 11){
finalSearchString = “http://www.ask.com/web?q=” + searchString + “&qsrc=0&o=312&l=dir&dm=all”;
}

location.href = finalSearchString;
}
}
</script>

<basefont face=”Verdana, Arial, sans-serif”>

<form name=”searchForm”>

<table width=480 height=”272″ border cellpadding=0 cellspacing=0 bgcolor=#C79B61 style=.BlueSearch>

<tr>
<td height=”164″ rowspan=”3″ bgcolor=#C79B61 class=”BlueSearch”><img src=”DelSearchMain.png” width=”344″ height=”164″>
<td height=”2″ colspan=”6″ bgcolor=#C79B61 class=”BlueSearch”>
<tr>
<td height=”71″ colspan=”6″ bgcolor=#C79B61 class=”BlueSearch”>Feature:
<tr>
<td height=”48″ colspan=”6″ bgcolor=#C79B61 class=”BlueSearch”><label>
<select style=”background: dddddd” name=”whichFeature”>
<option value=”” selected>None</option>
<option value=”define: “>Define</option>
<option value=”site: “>Site</option>
</select>
</label>
<tr>
<td height=”53″ bgcolor=#C79B61 class=”BlueSearch”>Search term:
<td bgcolor=#C79B61 class=”BlueSearch”>Search using:
<td colspan=”5″ bgcolor=#C79B61 class=”BlueSearch”>
<tr class=”BlueSearch”>
<td bgcolor=#C79B61 class=”BlueSearch”><input style=”background: dddddd” name=”searchText” type=”text”>
<td bgcolor=#C79B61 class=”BlueSearch”>
<select style=”background: dddddd” name=”whichEngine”>
<option selected>Google
<option>Altavista
<option>Yahoo!
<option>Excite
<option>Hotbot
<option>Infoseek
<option>Lycos
<option>AOL Netfind
<option>Dogpile
<option>Windows Live
<option>Ask Jeeves
</select>
<td bgcolor=#C79B61 class=”BlueSearch”><input type=”button” value=”Send” onClick=”startSearch()”>
</table>
</form>
</div>
</body>
</html>
[/CODE]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@cyber1Oct 27.2006 — The problem is you have used the name of your function as part of the search string.

if(searchEngine == 1){

finalSearchString = "http://www.google.com/search?sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8&q=" + [COLOR=Red]startFeature[/COLOR] + "" + searchString;

}
Copy linkTweet thisAlerts:
@trecool999authorOct 27.2006 — Thanks for your try but when I fixed up what you said it still didn't work...

Anyone else?
Copy linkTweet thisAlerts:
@cyber1Oct 27.2006 — Alright I'll post the whole thing.

[code=html]<html>
<head>
<style type="text/css">
<!--
.BlueSearch {
background-color: #C79B61;
border-width: 0;
}
-->
</style>
<title>Del-Search - The Eleven-In-One Search!</title>
<script language="JavaScript">
function startFeature(){
searchFeature = document.searchForm.searchText.value;
if(searchFeature != ""){
searchFeature = document.searchForm.whichFeature.selectedIndex + 1;
finalSearchString = "";

if(searchFeature == 1){
finalSearchFeature = "";
}
if(searchFeature == 2){
finalSearchFeature = "Define: ";
}
if(searchFeature == 3){
finalSearchFeature = "Site: ";
}

//location.href = finalSearchFeature;
}
}
function startSearch(){
searchString = document.searchForm.searchText.value;
if(searchString != ""){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = "";
startFeature();

if(searchEngine == 1){
finalSearchString = "http://www.google.com/search?sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8&q=" + finalSearchFeature + searchString;
}
if(searchEngine == 2){
finalSearchString = "http://www.altavista.com/web/results?itag=ody&q=" + finalSearchFeature + "" + searchString + "&kgs=1&kls=0";
}
if(searchEngine == 3){
finalSearchString = "http://search.yahoo.com/search?p=" + finalSearchFeature + "" + searchString + "&fr=yfp-t-500&toggle=1&cop=mss&ei=UTF-8";
}
if(searchEngine == 4){
finalSearchString = "http://msxml.excite.com/info.xcite/search/web/" + finalSearchFeature + "" + searchString;
}
if(searchEngine == 5){
finalSearchString = "http://www.hotbot.com/index.php?nil_suggest=btn&ps=&loc=searchbox&tab=web&mode=search&currProv=msn&query=" + finalSearchFeature() + "" + searchString;
}
if(searchEngine == 6){
finalSearchString = "http://search.yahoo.com/search?ei=UTF-8&trackingType=go_search_home&p=" + finalSearchFeature + "" + searchString + "&fr=hsusgo1";
}
if(searchEngine == 7){
finalSearchString = "http://search.lycos.com/?query=" + finalSearchFeature + "" + searchString;
}
if(searchEngine == 8){
finalSearchString = "http://search.aol.com/aolcom/search?invocationType=topsearchbox.webhome&query=" + finalSearchFeature + "" + searchString;
}
if(searchEngine == 9){
finalSearchString = "http://www.dogpile.com/info.dogpl/search/web/" + finalSearchFeature + "" + searchString + "/1/-/1/-/-/-/1/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/417/top/-/-/-/1";
}
if(searchEngine == 10){
finalSearchString = "http://search.live.com/results.aspx?q=" + finalSearchFeature + "" + searchString + "&mkt=en-gb&FORM=LVSP";
}
if(searchEngine == 11){
finalSearchString = "http://www.ask.com/web?q=" + finalSearchFeature + "" + searchString + "&qsrc=0&o=312&l=dir&dm=all";
}

location.href = finalSearchString;
}
}
</script>

</head>

<body>
<div style="position: absolute; left: 0; top: 0; width: 480px; height: 272px; z-index: 0; background-color: #C79B61; layer-background-color: #C79B61; border: 1px none #000000;">


<basefont face="Verdana, Arial, sans-serif">

<form name="searchForm">

<table width=480 height="272" border cellpadding=0 cellspacing=0 bgcolor=#C79B61 style=.BlueSearch>

<tr>
<td height="164" rowspan="3" bgcolor=#C79B61 class="BlueSearch"><img src="DelSearchMain.png" width="344" height="164">
<td height="2" colspan="6" bgcolor=#C79B61 class="BlueSearch">
<tr>
<td height="71" colspan="6" bgcolor=#C79B61 class="BlueSearch">Feature:
<tr>
<td height="48" colspan="6" bgcolor=#C79B61 class="BlueSearch"><label>
<select style="background: dddddd" name="whichFeature">
<option value="" selected>None</option>
<option value="define: ">Define</option>
<option value="site: ">Site</option>
</select>
</label>
<tr>
<td height="53" bgcolor=#C79B61 class="BlueSearch">Search term:
<td bgcolor=#C79B61 class="BlueSearch">Search using:

<td colspan="5" bgcolor=#C79B61 class="BlueSearch">
<tr class="BlueSearch">
<td bgcolor=#C79B61 class="BlueSearch"><input style="background: dddddd" name="searchText" type="text">
<td bgcolor=#C79B61 class="BlueSearch">
<select style="background: dddddd" name="whichEngine">
<option selected>Google
<option>Altavista
<option>Yahoo!
<option>Excite
<option>Hotbot
<option>Infoseek
<option>Lycos
<option>AOL Netfind
<option>Dogpile
<option>Windows Live
<option>Ask Jeeves
</select>
<td bgcolor=#C79B61 class="BlueSearch"><input type="button" value="Send" onClick="startSearch()">
</table>
</form>
</div>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@trecool999authorOct 27.2006 — Wow! Thanks, man! I really appreciate your help.

Thanks again!
×

Success!

Help @trecool999 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...