Jesper TMedlem sedan nov. 20017 058 inlägg
Hej jag skulle vilja kombinera dessa saker i en och samma presentation, hur gör man detta lättast månne??
Function WordLeft(strText, intNoOfWords)
Dim arrText, strippedText, I
arrText = Split(strText, " ")
If UBound(arrText) => intNoOfWords Then
For I = 0 To (intNoOfWords - 1)
If i = (intNoOfWords - 1) Then
strippedText = strippedText & arrText(i) & "..."
Else
strippedText = strippedText & arrText(i) & " "
End if
Next
Else
strippedText = strText
End If
WordLeft = strippedText
End Function
%>
presenteras med:
<%Response.write wordleft(RS("text"),5)
Vill kombinera med:
<%response.write replace(rs("text"),Query ,"<font style='BACKGROUND-COLOR: #33CCFF'>" & Query & "</font>",1,-1,vbTextCompare)%>
MVH
//Jesper
Erik JuhlinMedlem sedan maj 20007 625 inlägg
<%response.write wordleft(replace(rs("text"),Query ,"<font style='BACKGROUND-COLOR: #33CCFF'>" & Query & "</font>",1,-1,vbTextCompare))%>
eller ännu bättre:
Function QueryMarked(str, sQuery)
replace(str, sQuery , "<font style='BACKGROUND-COLOR: #33CCFF'>" & Query & "</font>", 1, -1,vbTextCompare)
End Function
response.write wordleft(QueryMarked(rs("text"),Query))
------------------
/Erik
www.juhlin.nu /sk8files/ /mp3d/
Jesper TMedlem sedan nov. 20017 058 inlägg
Microsoft VBScript compilation error '800a03ea'
Syntax error
/sok/search.asp, line 151
Function QueryMarked(str, sQuery)
^
Står det då!
Det som inte heller finns med i koden är ju siffran som anger meningens längd i ord.
<%Response.write wordleft(RS("text"),5)'<<<<<<<<<5 meningens längd i ord>>>>>>>>>>>>>>
//Jesper