Sådan her, får du hentet en *.txt fil ind i scriptet, men jeg kan ikke lige på stående fod gennemskue
www.domaine.dk og domaine.dk highlightningen :)
<%
Function WebString (Pstr)
StartPos = 0
Pstr = " " & Pstr & " "
SearchString1 = "
http://" SearchString2 = " "
SearchString3 = """
SearchString4 = ")"
SearchString5 = "'"
SearchString6 = ","
SearchString7 = "\"
SearchString8 = Chr(10)
SearchString9 = "<"
SearchString10 = ">"
Insert1 = "<A HREF=""#"" OnClick=""window.open('"
Insert2 = "','NettetStartSide','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,width=600,height=400,resizable=yes');"">"
Insert3 = "</A>"
Do
PstrLen = Len(Pstr)
' Find Link start
StartPos = InStr(StartPos + 1, Pstr, SearchString1)
' Find Link slut
EndPos1 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString2)
EndPos2 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString3)
EndPos3 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString4)
EndPos4 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString5)
EndPos5 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString6)
EndPos6 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString7)
EndPos7 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString8)
EndPos8 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString9)
EndPos9 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString10)
' Tilintetgør dem der er 0
If EndPos1 = 0 Then EndPos1 = PstrLen + 1
If EndPos2 = 0 Then EndPos2 = PstrLen + 1
If EndPos3 = 0 Then EndPos3 = PstrLen + 1
If EndPos4 = 0 Then EndPos4 = PstrLen + 1
If EndPos5 = 0 Then EndPos5 = PstrLen + 1
If EndPos6 = 0 Then EndPos6 = PstrLen + 1
If EndPos7 = 0 Then EndPos7 = PstrLen + 1
If EndPos8 = 0 Then EndPos8 = PstrLen + 1
If EndPos9 = 0 Then EndPos9 = PstrLen + 1
' Find den EndPos som er tættest på StartPos
EndPos = 0
If EndPos1 < EndPos2 And EndPos1 < EndPos3 And EndPos1 < EndPos4 And EndPos1 < EndPos5 And EndPos1 < EndPos6 And EndPos1 < EndPos7 And EndPos1 < EndPos8 And EndPos1 < EndPos9 Then EndPos = EndPos1
If EndPos2 < EndPos1 And EndPos2 < EndPos3 And EndPos2 < EndPos4 And EndPos2 < EndPos5 And EndPos2 < EndPos6 And EndPos2 < EndPos7 And EndPos2 < EndPos8 And EndPos2 < EndPos9 Then EndPos = EndPos2
If EndPos3 < EndPos1 And EndPos3 < EndPos2 And EndPos3 < EndPos4 And EndPos3 < EndPos5 And EndPos3 < EndPos6 And EndPos3 < EndPos7 And EndPos3 < EndPos8 And EndPos3 < EndPos9 Then EndPos = EndPos3
If EndPos4 < EndPos1 And EndPos4 < EndPos2 And EndPos4 < EndPos3 And EndPos4 < EndPos5 And EndPos4 < EndPos6 And EndPos4 < EndPos7 And EndPos4 < EndPos8 And EndPos4 < EndPos9 Then EndPos = EndPos4
If EndPos5 < EndPos1 And EndPos5 < EndPos2 And EndPos5 < EndPos3 And EndPos5 < EndPos4 And EndPos5 < EndPos6 And EndPos5 < EndPos7 And EndPos5 < EndPos8 And EndPos5 < EndPos9 Then EndPos = EndPos5
If EndPos6 < EndPos1 And EndPos6 < EndPos2 And EndPos6 < EndPos3 And EndPos6 < EndPos4 And EndPos6 < EndPos5 And EndPos6 < EndPos7 And EndPos6 < EndPos8 And EndPos6 < EndPos9 Then EndPos = EndPos6
If EndPos7 < EndPos1 And EndPos7 < EndPos2 And EndPos7 < EndPos3 And EndPos7 < EndPos4 And EndPos7 < EndPos5 And EndPos7 < EndPos6 And EndPos7 < EndPos8 And EndPos7 < EndPos9 Then EndPos = EndPos7
If EndPos8 < EndPos1 And EndPos8 < EndPos2 And EndPos8 < EndPos3 And EndPos8 < EndPos4 And EndPos8 < EndPos5 And EndPos8 < EndPos6 And EndPos8 < EndPos7 And EndPos8 < EndPos9 Then EndPos = EndPos8
If EndPos9 < EndPos1 And EndPos9 < EndPos2 And EndPos9 < EndPos3 And EndPos9 < EndPos4 And EndPos9 < EndPos5 And EndPos9 < EndPos6 And EndPos9 < EndPos7 And EndPos9 < EndPos8 Then EndPos = EndPos9
'
LinkLen = EndPos - StartPos
If StartPos <> 0 And EndPos <> 0 And LinkLen <> Len(SearchString1) Then
Link = Mid(Pstr, StartPos, EndPos - StartPos)
Pstr = Left(Pstr, StartPos-1) & Insert1 & Mid(Pstr, StartPos, EndPos + Len(SearchString2) - StartPos - 1) & Insert2 & Mid(Pstr, StartPos, EndPos + Len(SearchString2) - StartPos - 1) & Insert3 & Right(Pstr, Len(Pstr) - (EndPos + Len(SearchString2) - 2))
StartPos = StartPos + Len(Insert1) + LinkLen + Len(Insert2) + LinkLen + Len(Insert3)
End If
Loop While StartPos <> 0
Pstr = Mid(Pstr,2,Len(Pstr)-2)
WebString = Pstr
End Function
If Request("readfile") = "" Then
Response.Write "<form method='post' action='string.asp'><input type='file' name='readfile'> <input type='submit' value='Send'></form>"
End If
If Request("readfile") <> "" Then
Set filesys = CreateObject("Scripting.FileSystemObject")
Set txtfile = filesys.OpenTextFile(Request("readfile"),1,0)
Do
Line = txtfile.ReadLine
Response.Write WebString(Line) & "<br>"
Loop Until txtfile.AtEndOfStream
txtfile.close
End If
%>