473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Create a search function on a web page

Hi guys, I have a problem here. I have created a textbox and a button for search function, how do I get it to work without using forms?

Here is the code:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Public Folder Help Desk</title>

<script id=clientEventHandlersVBS language=vbscript>

<!--

Sub cmdSearch_onclick



End Sub

-->
</script>

</head>

<body>
<input type="text" name="txtSearch" size="18" tabindex="2">

<input type="button" value=" Search " name="cmdSearch" tabindex="3">

</body>

</html>

What must I enter in the Sub cmdSearch_onclick if I want to get the value where the user enters in the textbox?
May 25 '07 #1
4 2503
danp129
323 Expert 256MB
vbscript will only run in IE. Here's an example using Javascript.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  5. <title>Public Folder Help Desk</title>
  6.  
  7. <script language=javascript>
  8.  
  9. function search() {
  10.     window.location="http://www.google.com/search?q=" + window.escape(document.getElementById('txtSearch').value)
  11. }
  12.  
  13. </script>
  14.  
  15. </head>
  16. <body>
  17. <input type="text" id="txtSearch" name="txtSearch" size="18" tabindex="2">
  18. <input type="button" value=" Search " onclick="search();" name="cmdSearch" tabindex="3">
  19.  
  20. </body>
  21.  
  22. </html>
May 25 '07 #2
Hmm. You say vb only run in IE? Isn't it suppose to run on IE or vb in HTML codes doesn't run for Outlook? Must I really use Javascript instead of VB? Sorry for lots of question because I'm new to these things. Thanks in advance.
May 28 '07 #3
Ah.. Sorry, I tested out the code you post it here, the search function is working but I'm creating the search function for searching Outlooks item.
May 28 '07 #4
Is there any one can help me here? VB script will be preferred. My textbox is created in the <body> but my VB statement all is done in the <script> and I can't get to reach the textbox as in there's error showing that "txtSearch" cannot found. Please help, urgent. Thanks alot. Here's the code:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Public Folder Help Desk</title>

<script id=clientEventHandlersVBS language=vbscript>

<!--

Sub cmdSearch_onclick

(What statement should I put in here in order to make the search function works? And how can I get the data value that the user enter in the search textbox in the <body>? )

End Sub

-->
</script>

</head>

<body>
<input type="text" name="txtSearch" size="18" tabindex="2">

<input type="button" value=" Search " name="cmdSearch" tabindex="3">

</body>

</html>
May 29 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
1
by: D. Lee Christopher | last post by:
Can anyone point me to a good tutorial for creating a site-level search applet? I am trying to create a virtual catalog of sorts, and I would like to be able to search the catalog and have the...
5
by: Sally B. | last post by:
Hello, I searched, but couldn't find answers--probably because I'm not sure what this is called... Anyway, I have about 50 web pages and I want to have some JavaScript that will read in a list of...
5
by: Marek | last post by:
I'm trying to create a web page. I will have one column with records (table filled from dataset). If mouse will be on one from this records, i want to show a hint what is it (like in Windows -...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
11
by: admin | last post by:
Hi all, First time poster here... I'm a webmaster and I'd like to add a simple script to my website which will allow users to fill in a brief multiple choice questionaire, and then provide a...
3
by: weston | last post by:
I'm making a foray into trying to create custom vertical scrollbars and sliders, and thought I had a basic idea how to do it, but seem to be having some trouble with the implementation. My...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.