PDA

View Full Version : Defining an XML 'SRC' with a parameter from another page


JDRINWISC
08-18-2007, 11:23 PM
I figured out how to pass parameters between pages in my program but I cannot seem to plug the parameter into the SRC attribute. To clarify, I have a very large database with hundreds of files in XML format. I set up a menu in one HTML page for the user to select a file to use as a data source. I then pass this selection as a parameter using a query string to another HTML page which displays the information from the datafile:

<!--a href="../displaypg.htm?Drctry=subdir1/subdir2/&Wrkfile=datafile.xml"-->

I parsed the datafile name from the query string & verified that it passed ok by using the document.write function:

datafile = (param1['Drctry'])+(param2['dfile']);
document.write(datafile);

In the displaypage I placed a statement to embed the datafile:

<xml id="Person"; src="+datafile+"></xml>

There must be something wrong with the syntax because I cannot get it to read the data. I can get it to work if I have just one datafile that this page would use however, the "SRC" will vary each time the display page is called.
Is there an easy way to explain how to do this? Most of the tutorials I have looked at use terminology too advanced for a beginner like me to understand.

Thanks in advance,

JDRINWISC:confused:

Alex Vincent
08-19-2007, 05:42 AM
Why is the semicolon outside the attribute?

JDRINWISC
08-19-2007, 09:28 PM
OK, I'm not the best programmer. :o I got rid of the semicolon after the id name. I think the problem with the syntax is in MY plugging the 'Workfile' parameter into the 'SRC'. Does 'Workfile' have to be declared a certain way so 'SRC' doesn't think it is just a string? :confused: