/    Sign up×
Community /Pin to ProfileBookmark

Javascript search box

Hi there,

I am in need of a simple script,

My websites main page has links to different products, and when the different category is clicked the pages of product display in a frame in the middle of the page, now i need a search button on top of the page that will enable the user to enter in an item number (which all the item numbers have there own .html page to it) can display the html page in the frame of there choosing?

Can anyone help me out?

Thank you very much
Elaine ?

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@skywalker2208Mar 07.2008 — You wouldn't do a search with javascript. It would be done with a server side language like PHP. If someone had javascript turned off the whole functionality of your search wouldn't work.
Copy linkTweet thisAlerts:
@enemethauthorMar 07.2008 — OK is there a script for PHP that would do this?
Copy linkTweet thisAlerts:
@enemethauthorMar 07.2008 — I have this and i thought i would take it appart and make it search within a directory on my site to pull up the html pages they enter,

<form name="search" onSubmit="return searchit()">

<input type="text" size=30 name="search2" value="">

<input type="button" value="Go!" onClick="searchit()">

</form>

<script>

function searchit(){

window.location=document.search.search2.value

return false

}

</script>
Copy linkTweet thisAlerts:
@skywalker2208Mar 07.2008 — OK is there a script for PHP that would do this?[/QUOTE]
It depends on the type of server you are running if you can use PHP. If you are on a Microsoft server then you can't use PHP. You would have to use ASP.net.

From what you have said it sounds like you are not using a database for your site.
Copy linkTweet thisAlerts:
@enemethauthorMar 07.2008 — no i dont use database,

and i have all my pages in php except the ones that come up in the frames,

the search works but it brings up the http://www etc in the search field in a new window, which i just want it to search my site and pull up the item number in the frame,
Copy linkTweet thisAlerts:
@Declan1991Mar 08.2008 — It will only work for users who have Javascript enabled. Any use:[code=php]
function searchit(){
window.frames[0].location=document.search.search2.value
return false
}
[/code]
×

Success!

Help @enemeth 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.25,
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,
)...