Life in my own company

Its all up to me.
posts - 137, comments - 166, trackbacks - 113

My Links

News



Twitter



Tag Cloud

Archives

Post Categories

Play

Work

Debugging Javascript

I hate non-strongly typed languages, but when you're doing client stuff, you're stuck with Javascript.

So basically, I've created an XSL stylesheet and pass in some xml so that the page can dynamically be updated.  Only problem is XSL doesn't like Javascript.  So after replacing all of the verboden entities (i.e. < with &lt; etc), I'm able to get the java script to work.  Only problem, I'm matching on the id of the control, and if it's the one I want, I set the controls style property like so:

control.style.display='inline';

if it's not the one I want, I set it to:

control.style.display='none';

This works great until I add content to the page that has embedded html.  I'm iterating through all of the child controls of a single parent control and then hiding or revealing them as appropriate.  All I had to do was to restrict what controls I set the style on to only span controls.

Hmm--just thought of a bug, though.  All span controls will be hidden unless they have the right id, and since ids are unique, I can't use span controls in the html.  I guess I'm going to have to set them all to a special class and check both tagname AND their class.  Fun Fun!

Print | posted on Friday, December 16, 2005 12:22 PM | Filed Under [ Work ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 7 and 2 and type the answer here:

Powered by: