codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  DOM Changes Won`t Display  TomFrantz at 02:39 on Tuesday, November 23, 2004
 

I have a table in IE 6.0 listing several items where clicking on a row will bring up another window showing details for that item. Clicking a particular button on the detail window will change how that item appears on the initial list screen by altering it's background color, class name, and default cursor.

The problem I'm having is this -- sometimes it works and sometimes it doesn't.

There doesn't appear to be any rhyme or reason as to when it works and when it doesn't. Below is a code snippet showing how I'm going about making these changes. Any input would be appreciated.

trNode.className = "approved";
trNode.style.backgroundColor = approvedColor;
trNode.style.cursor = "default";

  Re: DOM Changes Won`t Display  tgreer at 02:51 on Tuesday, November 23, 2004
 

Can you post a link? It's hard to troubleshoot these kinds of problems without seeing the page, and know what OS and Browser exhibits the problem.



  Re: DOM Changes Won`t Display  TomFrantz at 02:59 on Tuesday, November 23, 2004
 

This is an intranet application I support at work, so I'm afraid I cannot post a link. I'm running it using IE 6.0 on a windows platform. WinXP and Win2k to be precise.

  Re: DOM Changes Won`t Display  tgreer at 03:25 on Tuesday, November 23, 2004
 

Ok, we'll see what we can do.

First, with CSS it's extremely important to use a correct DocType. Are you declaring a doctype in your pages?

http://www.w3.org/QA/2002/04/valid-dtd-list.html

You say you have a table "where clicking on a row". That's an actual HTML <table>, then right? With an <input type=button> tag with an onclick handler, which calls a JavaScript function, correct? You're clicking a button, not row, right?

That function opens a new window, where something happens, that causes you to change the styles in the parent window's table. Right?

How are you referencing the parent window from the child window? How do you retrieve the reference to "trNode"?



  Re: DOM Changes Won`t Display  TomFrantz at 03:46 on Tuesday, November 23, 2004
 

I see what you mean about needing the details.

I am not using a DOCTYPE. Good Catch!!! I didn't realize it was that important.

It is an actual HTML table where I'm clicking on a row element (<tr>) not a button to bring up the child window.

When a button is clicked (<input type="button">) within that child window the appearance of the original table row is supposed to change. I am using the onclick() event.

I'm getting my reference to the table row on the original page during the onclick event for that <tr> element by passing "this" and storing it in a global variable.

  Re: DOM Changes Won`t Display  tgreer at 04:11 on Tuesday, November 23, 2004
 

At this point, I would suggest that you apply whichever DOCTYPE you think is most appropriate. I would start with a strict HTML doctype.

Next, run the page(s) through a validator:

http://validator.w3.org

Then, run the CSS through a validator:

http://jigsaw.w3.org/css-validator/

Once you've got good, valid HTML and CSS, we'll look at the JavaScript.



  Re: DOM Changes Won`t Display  TomFrantz at 04:19 on Tuesday, November 23, 2004
 

I've never used a validator, but I am aware of what they are used for. However, these are JSP pages I'm working on. Should I use the "view source" option from IE and run that through the validator? I tried the HTML 4.0 transitional DOCTYPE, but that did not solve my problem.

Thanks for working with me on this. I'm on the east coast so I'm afraid I have to call it a night for now. I will pick this back up in the morning.

  Re: DOM Changes Won`t Display  tgreer at 17:17 on Wednesday, November 24, 2004
 

How are things going? Any closer to an answer? Need some more help?

I'm not familiar with JSP, but copying/pasting code from "View Source" into the validator should be fine.



  Re: DOM Changes Won`t Display  TomFrantz at 03:44 on Thursday, November 25, 2004
 

Thanks for checking in on me. The problem still occurs intermittently and I'm running out of ideas on how to deal with it. I've tried to get help from other sources on the web and a newsgroup, but everyone wants to see my code and it's just not that easy when it's part of a large web application requiring tag libs, javascript libraries, database connections, and some proprietary data.

So, what I think I'm going to do is create some static html test pages using hard-coded data to see if I can recreate the problem. If I can, I'll post them on the forum for others to dissect.

The page I'm trying to update is contained within an <iframe> so I'm thinking that might have something to do with it. I've got to figure this out! There must be a way to get this to work.

  Re: DOM Changes Won`t Display  tgreer at 04:06 on Thursday, November 25, 2004
 

Your approach is definitely the correct one. Start with small static pages, and slowly build them up until you spot the problem. It's frustrating and time-consuming, but you can't rely on flashes of inspiration all the time - sometimes you just have to do the hard work!

I think there's a saying, "the problem with doing something right the first time, is that no one appreciates how hard it was."

I'll help if I can. Troy Wolf, another site member, is brilliant with JavaScript, so definitely keep CodeToad in mind. Another good forum is Tek-Tips, just to get some more opinions.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  matrix addition
•  Re: Storing data from HTML to Excel or TXT
•  Re: function within loop problem
•  Re: Ô‡´ò¥¯¥é¥Ö¤à ¥Æ©`¥é©`¥á¥¤¥É£ò£±£±¥¢¥¤¥¢¥ó ¤Î£··¬ ¤Ç¤¹
•  Re: Replace
•  Re: タイトリスト AP2アイアン 712ã�®æƒ…å �
•  Re: SMS from Perl using HTTP request
•  Re: Charl Schwartzel
•  Re: Adhyayan - Annual Student Conference and Online Coding Festival


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2013