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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 3rd, 2008, 10:29 AM
Authorized User
 
Join Date: Feb 2007
Location: Binghamton, NY, USA.
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to toddw607 Send a message via Yahoo to toddw607
Default Problem with styles

Hello all, i have the following javascript program:
         
Code:
xmlDoc = document.implementation.createDocument("","",null);
Code:
xmlDoc.async=false;
xmlDoc.load("homepage_moz.xml");
document.write('<p class="headline">')
document.write(xmlDoc.getElementsByTagName("heading")[0].childNodes[0].nodeValue)
document.write('</p>')
document.write('<p class="centertext">'+xmlDoc.getElementsByTagName("paragraph")[0].childNodes[0].nodeValue+'</p>'+'<a href="#ils">'+xmlDoc.getElementsByTagName("link")[0].childNodes[0].nodeValue+'</a>')
document.write('<p class="centertext">'+xmlDoc.getElementsByTagName("paragraph")[1].childNodes[0].nodeValue+'</p>')
document.write('<a href="#manuals">'+xmlDoc.getElementsByTagName("link")[1].childNodes[0].nodeValue+'</a>')
document.write('<p class="centertext">'+xmlDoc.getElementsByTagName("paragraph")[3].childNodes[0].nodeValue+'</p>')
document.write('<a href ="#transit"> '+xmlDoc.getElementsByTagName("link")[2].childNodes[0].nodeValue+'</a>')
document.write('<p class="centertext">'+xmlDoc.getElementsByTagName("paragraph")[5].childNodes[0].nodeValue+'</p>')
document.write('<a href="#contact"> '+xmlDoc.getElementsByTagName("link")[3].childNodes[0].nodeValue+'</a>')
document.write('<p class="borderline"></p>')
All this does is writes from a xml document to a xml document when when I do this (In Mozilla) all the links are aligned to the upper right hand side of the screen and all the entries are on seperate lines (Each being their own paragraph when using document.write should alleviate the seperate lines). Any thoughts on this? There is nothing to my knowledge in the CSS that would do this. Any help would be greatly appreciated. TIA

Reply With Quote
  #2 (permalink)  
Old June 3rd, 2008, 11:40 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

HI toddw607!!

Could you please confirm the css file is loaded before this code is written to the page??


Cheers :)

vinod
Reply With Quote
  #3 (permalink)  
Old June 3rd, 2008, 11:48 AM
Authorized User
 
Join Date: Feb 2007
Location: Binghamton, NY, USA.
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to toddw607 Send a message via Yahoo to toddw607
Default

Hi Vinod,
      Thanks for the RE. The html page that is actually displayed is called index.html and this javascript function
is called from within the <head> of that program which then loads the homepage_moz.xml page from it. The css is loaded
from the index.html file within the head tag before this javascript function is called. I also made alteration to it and
they worked with this page so I know it's loaded. Do you think this problem lies within the javascript or CSS? Thanks Again!

Reply With Quote
  #4 (permalink)  
Old June 3rd, 2008, 12:37 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Yes I do think so..
I got the same issue with one of my .net application.

you can do one more thing??
after page load you try to reload the css with the help DOM..

Note-I tried it ,it worked for me...



Cheers :)

vinod
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
problem with order of application of styles hertendreef ASP.NET 2.0 Basics 0 May 15th, 2007 03:28 AM
Styles tsimsha HTML Code Clinic 2 February 9th, 2006 11:32 AM
XP Visual Styles problem katsarosj VB.NET 2 April 14th, 2005 11:39 AM
Styles problem tsimsha HTML Code Clinic 9 November 17th, 2004 09:58 AM



All times are GMT -4. The time now is 05:10 AM.


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