Rh0ads
Oct 8th, 2002, 04:22 PM
Hi, I'm fairily new to Javascript and not too good in it. I want to make a script that prints the name of the file on the page. ex: it's located at http://www.blah.com/dir/page.html and i want the page to say "page". I have this code from VB, which does the trick:
URL=Replace(URL,".html","")
URL=Replace(URL,".htm","")
For a& = Len(URL) To 1 Step -1
If Mid(URL, a, 1) = "/" Then
b$ = Mid(URL, a + 1, Len(URL) - a)
MsgBox b
End
End If
Next a
Can anyone give me the Javascript equivilant? or something that accomplishes what i described above?
Thanks
-George
URL=Replace(URL,".html","")
URL=Replace(URL,".htm","")
For a& = Len(URL) To 1 Step -1
If Mid(URL, a, 1) = "/" Then
b$ = Mid(URL, a + 1, Len(URL) - a)
MsgBox b
End
End If
Next a
Can anyone give me the Javascript equivilant? or something that accomplishes what i described above?
Thanks
-George