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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing an xml object 1

Status
Not open for further replies.

karlito

Technical User
Jun 28, 2001
8
GB
hi there, I am about to give up on this, so I really hope someone can help me out. thanks

MY INTENTION:
I have a table listing a collection of articles available in an XML file. By clicking on the row, the user should be able to email a specific user, with the article title inserted in the email.

SO FAR:
I have an HTML file that loads the XML and XSL files.
The xsl file display the table pretty nicely. When the user clicks on the appropriate row, a javascript calls and displays the information on the email, however a second javascript that is expected to display the actual selected article title (from the XML file) in the message body does not work.

It comes back with: [undefined]instead of the article title.

PROBLEM:
It seems to me that it is not recognising the object I am intending to access.

Any ideas?

Thanks

The table row in the XSL document:
<td onclick=&quot;mailkn()&quot;><xsl:value-of select=&quot;TOPIC&quot;/></td>

Typing the info on the Mail program:
function mailkn()
{
var vEmail = &quot;kn@mail.com&quot;
var vSubject = &quot;Article details&quot;
var vBody = &quot;Can i have a copy of: &quot; + testclick(this)

document.location = &quot;mailto:&quot; + vEmail + &quot;?subject=&quot; + vSubject + &quot;&body=&quot; + vBody
}

Getting the information from the appropriate ELEMENT on the XML File:
function testclick(field)
{
var row=field.parentElement.rowIndex
future_tb.recordset.absoluteposition=row
return(future_tb.recordset(&quot;TOPIC&quot;))

}

 
Hello,
I'm not exactly sure what is the intention of function testclick(field).
I did some modifications in your code (to have the selected from user title appear in the mail message body):

function mailkn(field)
{
var vEmail = &quot;kn@mail.com&quot;
var vSubject = &quot;Article details&quot;
var vBody = &quot;Can i have a copy of: &quot; + field

document.location = &quot;mailto:&quot; + vEmail + &quot;?subject=&quot; + vSubject + &quot;&body=&quot; + vBody
}

and

<td onclick=&quot;mailkn(this.innerText)&quot;><xsl:value-of select=&quot;.&quot;/></td>

Obviously it will work in IE only.
Hope this helps.
D
 
Dianal,

Thanks, your alterations do exactly what I want.
I just did not have a clue on how to pass on the actual information to be printed on the mail program.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top