I want to highlight the keywords in 6 textboxes in various colors.
page 1:
[code<%
OPTION EXPLICIT
Response.Buffer = True
Response.Expires = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>demo of linked listboxese</title>
</head>
<script language="javascript">
function fillverse(lstSource, lstDest) {
// look for the selected element in the listbox named by parm "lstSource"
// find its value... that's a string consisting of
// chapter number + comma + number of verses
// our job is to fill in the downstream "lstDest" with integers from 1 to that number
clearComboOrList(lstDest);
if (lstSource.selectedIndex > -1) {
var sVal = lstSource.options[lstSource.selectedIndex].value;
if (sVal.indexOf(",") > 0) {
lstDest.options[lstDest.options.length] = new Option("all", "all");
var arrX = sVal.split(",");
var numVerses = parseInt(arrX[1]);
for (var i = 1; i <= numVerses; i++) {
lstDest.options[lstDest.options.length] = new Option(i);
}
if (lstDest.options.length == 0) {
lstDest.options[lstDest.options.length] = new Option("Make a selection");
}
} else lstDest.options[lstDest.options.length] = new Option("Make a selection");
} else lstDest.options[lstDest.options.length] = new Option("Make a selection");
}
function retrieveverse(lstBook, lstChapter, lstVerse){
// look in the identified listboxes to find the selected book, chapter, and verse
// then create a querystring that displays the targeted element in an iframe
// by calling page showVerse.asp
if (lstBook.selectedIndex > -1 && lstChapter.selectedIndex > -1 && lstVerse.selectedIndex > -1) {
var sBook = lstBook.options[lstBook.selectedIndex].value;
var sChap = lstChapter.options[lstChapter.selectedIndex].text;
if (!isNaN(sChap)){
var sVerse = lstVerse.options[lstVerse.selectedIndex].text;
var sHref = "showVerse.asp?b=" + sBook + "&c=" + sChap + "&v=" + sVerse;
for (var i = 0; i < document.f1.Keyword.length; i++) {
var vSearch = document.f1.Keyword[i].value;
if (vSearch != "") {
sHref += "&keywords=" +vSearch;
}
}
document.ifrVerse.location.href = sHref;
}
}
}
</script>
<body>
<form name="f1">
<table border="1" bgcolor="beige" align="center" xwidth="100%">
<table border="1" width="100%">
<tr>
<td width="50%">
<div align="center">
<center>
</center>
</td>
<table border="1" bgcolor="beige" align="center" xwidth="200%">
<tr><th>book</th><th>chapter</th><th>verse</th></tr>
<tr>
<%
Dim objCon, objList
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.CursorLocation = adUseClient
objCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("kjv.mdb") & ";" & _
"User Id=admin;Password="
' create a new chain of listboxes
Set objList = New cDynListbox
Set objList.Connection = objCon
objList.Is2000 = False
' create the primary cell
With objList.NewCell()
.Size = 5
.Table = "books"
.Text = "book_title"
.Value = "book"
.Name = "book"
.StyleInfo = "style='width:150;'"
.AltOrderField = "book"
End With
' create the secondary cell
With objList.NewCell()
.Size = 5
.Name = "chapter"
.SourceLink = "book"
.DestLink = "book"
.Table = "chapters"
.Text = "chap"
.Value = "chapmaxv"
.StyleInfo = "style='width:120;' onchange='fillverse(this,document.f1.verse);' "
End With
%>
<td><%objList.GetCell(1).Render%></td>
<td><%objList.GetCell(2).Render%></td>
<td><select name="verse" size="5" style="width:120;" >
Make a selection</select></td>
<td><p><input name="f1" type="submit" value=" Search " onclick="retrieveverse(document.f1.book,document.f 1.chapter,document.f1.verse);return(false);">
<input type="reset" name="B2" value="Clear"></p></td>
</tr>
<tr>
<td colspan="3">
<table>
<tr>
<td width="50%"> <br>
<b>Text 1</b><br>
<input size="10" name="Keyword"></td>
<td width="50%"> <br>
<b>Text 2</b><br>
<input size="10" name="Keyword"></td>
</tr>
<tr>
<td width="50%"> <br>
<b>Text 3</b><br>
<input size="10" name="Keyword"></td>
<td width="50%"> <br>
<b>Text 4</b><br>
<input size="10" name="Keyword"></td>
</tr>
<tr>
<td width="50%"> <br>
<b>Text 5</b><br>
<input size="10" name="Keyword"></td>
<td width="50%"> <br>
<b>Text 3</b><br>
<input size="10" name="Keyword"></td>
</tr>
</table>
</td>
</tr>
<tr><td align="center" colspan="3"><iframe name="ifrVerse" id="ifrVerse" src="about
:blank" style="height:200; width:450;"></iframe></td></tr>
</table>
</form>
<%
Set objList = Nothing
objCon.Close
Set objCon = Nothing
%>
<h2>someone <i>please</i> tell me why I did this</h2>
</body>
</html>[/code]
page 2 (response)
[code<%
OPTION EXPLICIT
Response.Buffer = True
Response.Expires = 0
Dim objCon
Dim rs
Dim sq
Dim iCounter
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>show an individual verse</title>
</head>
<body>
<%
' prevent sql injection attacks
If Instr(Request("b"), "'") > 0 Or Request("b") = "" Then
Response.End
ElseIf Instr(Request("c"), "'") > 0 Or Request("c") = ""Then
Response.End
ElseIf Instr(Request("v"), "'") > 0 Or Request("v") = ""Then
Response.End
End If
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("kjv.mdb") & ";" & _
"User Id=admin;Password="
Set rs = Server.CreateObject("ADODB.Recordset")
If Request("v") = "all" Then
sq = "select text_data, book_title, chap, vers " & _
"from bible " & _
"where book='" & Request("b") & "' " & _
" and chap=" & Request("c") & _
" ORDER BY vers"
Else
sq = "select text_data, book_title, chap, vers FROM bible WHERE "
iCounter = 0
Dim sKeyword
For Each sKeyword in Request("Keywords")
If Trim(sKeyword) <> "" Then
sq = sq & "text_data LIKE '%" & sKeyword & "%' AND "
End If
iCounter = iCounter + 1
Next
sq = sq & " book='" & Request("b") & "' " & _
" and chap=" & Request("c") & _
" and vers=" & Request("v")
End If
rs.Open sq, objCon%>
<%
If rs.EOF Then
Response.Write "verse not found: " & request("b") & ", " & Request("c") & ", " & Request("v")
ElseIf IsNull(rs(0)) Then
Response.Write "verse not found: " & request("b") & ", " & Request("c") & ", " & Request("v")
Else
Response.Write "Looking for <b>" & Request("Keywords") & "</b>.<br>"
%>
<b><%=rs("book_title")%> <%=rs("chap")% ></b>
<% Do Until rs.EOF
Response.Write "<p>"
Response.Write rs("vers")
Response.Write " " & rs(0) & "</p>"
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
objCon.Close
Set objCon = Nothing
%>
</body>
</html>[/code]
include file for highlighting found in showverse.asp
Code:
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Function Highlight(strText, strFind, strBefore, strAfter)
Dim nPos
Dim nLen
Dim nLenAll
nLen = Len(strFind)
nLenAll = nLen + Len(strBefore) + Len(strAfter) + 1
Highlight = strText
If nLen > 0 And Len(Highlight) > 0 Then
nPos = InStr(1, Highlight, strFind, 1)
Do While nPos > 0
Highlight = Left(Highlight, nPos - 1) & _
strBefore & Mid(Highlight, nPos, nLen) & strAfter &_
Mid(Highlight, nPos + nLen)
nPos = InStr(nPos + nLenAll, Highlight, strFind, 1)
Loop
End If
End Function
</SCRIPT>
<%
'OPTION EXPLICIT
Dim strText, strFind
strFind=Keyword
strText=RS("text_data")
strText= Highlight(strText, strFind,"<b>", "</b>")
strFind=Keywordb
strText= Highlight(strText, strFind,"<b>", "</b>")
strFind=Keywordc
strText= Highlight(strText, strFind,"<b>", "</b>")
strFind=Keywordd
strText= Highlight(strText, strFind,"<b>", "</b>")
strFind=Keyworde
strText= Highlight(strText, strFind,"<b>", "</b>")
strFind=Keywordf
strText= Highlight(strText, strFind,"<b>", "</b>")
Response.Write strText
%>
I think it has to be rewritten since there was a change in the first two files. It's not working, highlighting the keywords.
here it is:
http://i.domaindlx.com/wheelofgod/tripledemo.asp
Learning of our true origins.
I feel sorry:
http://www.infowars.com/articles/wor...eknowledge.htm
Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean