 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 2nd, 2004, 12:07 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
|
|
how to highlight in three colours? have code but
There is something wrong in this. I couldn't figure it out.
I have three: Keyword, Keywordb, Keywordc
I had inserted: strSearchFor, two, three (same function)
Code:
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Function stringReplace(strSearchWithin,strSearchFor,two,three)
Dim lngStartingPosition
Dim lngFoundPosition
Dim strReplaced
'Set the start position
lngStartingPosition=1
lngFoundPosition=InStr(lngStartingPosition,strSearchWithin,strSearchFor,1)
lngFoundPosition=InStr(lngStartingPosition,strSearchWithin,two,1)
lngFoundPosition=InStr(lngStartingPosition,strSearchWithin,three,1)
do while lngFoundPosition > 0
'found
strReplaced=strReplaced & Mid(strSearchWithin,lngStartingPosition,lngFoundPosition-lngStartingPosition) & "" & "<b>" & mid(strSearchWithin,lngFoundPosition,len(strSearchFor)) & "</b>" & ""
strReplaced=strReplaced & Mid(strSearchWithin,lngStartingPosition,lngFoundPosition-lngStartingPosition) & "" & "<b>" & mid(strSearchWithin,lngFoundPosition,len(two)) & "</b>" & ""
strReplaced=strReplaced & Mid(strSearchWithin,lngStartingPosition,lngFoundPosition-lngStartingPosition) & "" & "<b>" & mid(strSearchWithin,lngFoundPosition,len(three)) & "</b>" & ""
lngStartingPosition=lngFoundPosition+len(strSearchFor)
lngStartingPosition=lngFoundPosition+len(two)
lngStartingPosition=lngFoundPosition+len(three)
lngFoundPosition=InStr(lngStartingPosition,strSearchWithin,strSearchFor,1)
lngFoundPosition=InStr(lngStartingPosition,strSearchWithin,two,1)
lngFoundPosition=InStr(lngStartingPosition,strSearchWithin,three,1)
Loop
stringReplace=strReplaced & Mid(strSearchWithin,lngStartingPosition) 'catch the last one
End Function
</SCRIPT>
<%
strSearchWithin=RS("res_text_data")
strSearchFor=Keyword
two=Keywordb
three=Keywordc
Response.Write stringReplace(strSearchWithin,strSearchFor,two,three)
%>
|
|

October 2nd, 2004, 07:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi there,
Quote:
|
quote:There is something wrong in this. I couldn't figure it out.
|
So you want someone to find what is wrong? hmmm, that is tough.
How about explaining on what is "there is something wrong in this".
It is better to explain what you are trying to accomplish and what is that you are
stuck up with / trying to figure out, than expecting someone to go through the code and
analyse what it does and then find what is the clue that is being given to us here.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

October 2nd, 2004, 11:01 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
|
|
what I'm getting is a repetition of "res_text_data" three times after a word is highlighted:
[u]Now after these things</u>, in the reign of Artaxerxes king[u]Now after these things[u], in the reign of Artaxerxes king of Pe[u]Now after these things</u>, in the reign of Artaxerxes king of Persia, Ezra the son of Seraiah, the son of Azariah, the son of Hilkiah,
I had forgotten to include the Dim in the previous posting:
Code:
<%Dim strSearchWithin,strSearchFor,two,three%>
|
|

October 2nd, 2004, 11:04 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Ok it would also help to mention you that the three keywords are:
Ezra, Artaxerxes, king. So when you see those words there is a repetition of the text.
|
|
 |