Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass link to a frame

Status
Not open for further replies.

huobaji

Technical User
Sep 20, 2010
23
0
0
US
Hello
Thanks in advance.

This code loops through a directory and places the value in a response.write link.

I am using Frames to display the data. I have a left frame and a content (right) frame. Right now it shows the file content in the left frame once I click it. What I would like to do is this

Once i click the link the file (XML) would be displayed in the Content ( right )frame


Does anyone know how to do this

<%
dim fs,fo,x
ListFolderContents(Server.MapPath("/My/Path")) %>

<% sub ListFolderContents(path)

dim fs, folder, file, item, url, it

set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)


for each item in folder.Files
url = MapURL(item.path)
Response.Write("<li><a href=""" & url & """>" & item.Name & "</a> - " _
& "last modified on " & item.DateLastModified & "." _
& "</li>" & vbCrLf)

next
response.write url
Response.Write("</ul>" & vbCrLf)
Response.Write("</li>" & vbCrLf)
end sub

function MapURL(path)
dim rootPath, url
' Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath("/")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")

end function %>


</p>
 
[0] suppose you have a frameset like this.
[tt]
<frameset cols="35%,*">
<frame name="left" src="xyz.asp" />
<frame name="right" />
</frameset>
[/tt]
[1] Put a target attribute to the links like this.
[tt]
<a href=""" & url & """ [blue]target=""right""[/blue]>" & item.Name & "</a>
[/tt]
[2] Make sure the ul and li nested correctly.
 
Cool this works.

I have another question or problem. Is there way to setup the link to open the file (XML) and read it then display the nodes on the right frame.


Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("file.xml"))

Dim Org
Dim Address1
Dim Address2
Dim City

Org = xml.getElementsByTagName("OrganizationName")(0).text
Address1 = xml.getElementsByTagName("AddressLine")(0).text
Address2 = xml.getElementsByTagName("AddressLine")(1).text
City = xml.getElementsByTagName("City")(0).text
'
response.write Org
response.write("<br>")
response.write Address1
response.write("<br>")
response.write Address2 &vbcrlf
response.write City

Set xml = Nothing
 
[3] >I have another question or problem. Is there way to setup the link to open the file (XML) and read it then display the nodes on the right frame.

[3.1] You can do by linking to a href pointing to an asp page, say display.asp, passing the file name (I use url as used, make sure it is a relative or simply a file name: you don't want to expose the absolute path. As MapURL() is an unshown function, make sure you have path's etc properly scripted.)

[3.2] In left page, the anchor href look something like this.
[tt]
<a href=[blue]""display.asp?f=" & escape(url)[/blue] & """ target=""right"">" & item.Name & "</a>
[/tt]
[3.3] In the display.asp, the file.xml line looks like this.
[tt]
xml.load Server.MapPath(request.querystring("f"))
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top