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

MSN & Yahoo

Status
Not open for further replies.

DizzyD

IS-IT--Management
Joined
Apr 16, 2006
Messages
5
Location
US
Does anyone know the code, if it is java, that msn and yahoo use for their search form, when you click on a different link (ex: web, images, etc...). I am trying to create a search form for my site for 3 different sections, but they need different commands, so this would make life so much easier. Thanks for any help...


David
 
The code that does the searching would be server-side, not client-side JavaScript (note: Java and JavaScript are very different languages).

My advice would to ask in the forum for whatever server software you are hosting your pages on, about how to implement a search feature.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
are you talking about backend or frontend? I just wanna know how to create 3 different forms and implement into one changable form. With out using radio or drop down. Basicly change the form without leaving the page. Like iFrames but I don't wanna use iframe. Thanks for the quick reply!

David
 
I was talking back-end - which is why I said "server-side".

I just wanna know how to create 3 different forms and implement into one changable form. With out using radio or drop down. Basicly change the form without leaving the page

Well why didn't you say so? That's totally different to what you asked for in your first post.

If that's what MSN and Yahoo do, why not simply view the source to their page and copy their code?

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
That's what I was orriginally going to do, but if you haven't looked at yahoo and msn source code, you should and would see how outragious it is.
 
Use an ID'd div to hold your tab contents, and just replace the innerHTML in the div.

Code:
<a href="#" onClick="showForm('web')">Web Search</a><br>
<a href="#" onClick="showForm('images')">Images Search</a><p>

<div id="formdata">Web Search: ...</div>

<script language="JavaScript">
function showForm (lab) {
   if (lab == 'web') {
      document.getElementById('formdata').innerHTML = "Web Search: ...";
   }
   else if (lab == 'images') {
      document.getElementById('formdata').innerHTML = "Images Search: ...";
   }
   else {
      window.alert ("Error: " + lab + " isn't a valid search label");
   }
}
</script>
 
That works great, as far as displaying different text without leaving the page. However when I tried to input html the links didn't work correctly. When the web or images link was clicked, nothing happened. Any idea why?

Thanks again for all the great help so far!

David
 
I wanted in the innerhtml area for web to display something like this
~~
<form action="page.php" method="post">
<td valign="middle"><BR><center><input name="websearch" class="textboxbig"

type=text value="" size=60>&nbsp;<input type="submit" name="Submit"

value="Search">
~~
And then the Images to be a form but the method to be GET instead of post and a different action.

~~
<form action="/search/search.php" method="get">
<td valign="middle"><BR><center><input name="websearch" class="textboxbig"

type=text value="" size=60>&nbsp;<input type="submit" name="Submit"

value="Search">
~~

If that makes sense. And one last question. The data that orriginaly shows up (in the div tags) How do a create a link to display that data.
If I make that data the web search, then someone clicks images, it changes. But what link do I make for it to go back to that orriginal form? Thanks so much.. You've been a great help


David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top