|
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";
|
|
|
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.
|
|
|
|
|
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.
|
|
|
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"?
|
|
|
|
|
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.
|
|
|
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.
|
|
|
|
|
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.
|
|
|
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.
|
|
|
|
|
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.
|
|
|
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.
|
|
|
|
|
|
|
|
|
|