Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 23rd, 2010, 10:27 PM
Registered User
 
Join Date: Sep 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Table Cells Links

Hi All,

I tried to add links to open local xml files in browser by clicking in a dynamic table cells. I need help. I tried all ways but I think I miss something.
I can open them without table just by document.write(xmlfile location).
Here is my code. please help.
function showResultsTable(searched, srchedname) {
// get the reference for the body
var mybody = document.getElementsByTagName("body")[0];

// creates a <table> element and a <tbody> element
mytable = document.createElement("table");
mytable.setAttribute('id', 'resulttable');
mytablebody = document.createElement("tbody");

// creating all cells
var mycurrent_cell = new Array();

for(var j = 0; j < srchedname.length; j++) {
// creates a <tr> element
mycurrent_row = document.createElement("tr");

mycurrent_cell[0] = document.createElement("td");
currenttext = document.createTextNode(j);
mycurrent_cell[0].appendChild(currenttext);
mycurrent_row.appendChild(mycurrent_cell[0]);


mycurrent_cell[1] = document.createElement("td");
link = document.createElement("a");
link.name = ""+srchedname[j]);
link.href = "C:\\AAA\\TestCasesList.xml";
mycurrent_cell[1].appendChild(link);
mycurrent_row.appendChild(mycurrent_cell[1]);


mycurrent_cell[2] = document.createElement("td");
currenttext = document.createTextNode(searched[j]);
mycurrent_cell[2].appendChild(currenttext);
mycurrent_row.appendChild(mycurrent_cell[2]);

// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
}
// appends <tbody> into <table>
mytable.appendChild(mytablebody);
// appends <table> into <body>
mybody.appendChild(mytable);
// sets the border attribute of mytable to 2;
mytable.setAttribute("border", "2");

}
Reply With Quote
  #2 (permalink)  
Old July 25th, 2010, 06:36 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

And the problem is? I would help if you explained what exactly you need help with. I don't think people will copy the code, run it in a browser, create local XML files and then try to figure out what your problem could be.... Detailed questions == detailed answers.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old July 25th, 2010, 10:09 AM
Registered User
 
Join Date: Sep 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
And the problem is? I would help if you explained what exactly you need help with. I don't think people will copy the code, run it in a browser, create local XML files and then try to figure out what your problem could be.... Detailed questions == detailed answers.

Imar
Hi Imar,

I am really surprised that the first sentences did not clearly understood.

"I tried to add links to open local xml files in browser by clicking in a dynamic table cells. I need help. I tried all ways but I think I miss something.
I can open them without table just by document.write(xmlfile location)."


I did not give my complete code, I gave my function to male issue more understanding and not for copying and run.

To clarify it further, Issue#1: I have multiple xml files in my local directory say at C:\AAA\ Test Me Now.xml, Test After.xml. I need to open that file in browser through my application. I can open that by document.write(). But I want it formatted as in table. I need to display file names as Hyperlinks.
Issue#2: When file names have blank spaces IE does not open them.

Can you suggest now?
Reply With Quote
  #4 (permalink)  
Old July 25th, 2010, 10:57 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Are they true XML files? In that case, you may want to look into XSLT; it's designed to transform XML documents to other formats such as HTML...

Other than that, I can't recommend much as it's still unclear to me what you're trying to do....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old July 27th, 2010, 09:32 AM
Registered User
 
Join Date: Sep 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Are they true XML files? In that case, you may want to look into XSLT; it's designed to transform XML documents to other formats such as HTML...

Other than that, I can't recommend much as it's still unclear to me what you're trying to do....

Imar
Hi Imar,
Thanks for your efforts in trying to understand the issue, I got reply from tsuji.
http://www.tek-tips.com/viewthread.c...1613422&page=1
My issue solved.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Table cells as links gjeardle HTML Code Clinic 16 January 24th, 2007 12:08 PM
Dynamic Links in Crystal Reports (VS.Net 2005) harini311 Crystal Reports 0 September 9th, 2006 10:44 PM
Arrange dynamic cells... Roshu Javascript How-To 1 January 11th, 2005 06:55 AM
Table Links samdavis HTML Code Clinic 2 November 30th, 2004 06:38 AM
Entering data to dynamic table cells weebadbilly XSLT 0 June 30th, 2004 07:15 AM



All times are GMT -4. The time now is 04:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.