CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 4th, 2004, 06:27 PM
discotiger discotiger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 32 discotiger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 7 m 28 sec
Reputation Power: 5
Trouble combining CSS and JS Objects

For a page I'm writing, when I call a new object, a document.write() line is called in which it writes html/css tags to bring a picture corresponding to that object on the page. The problem is it won't let me change the properties that I normally could, such as .top or .left, etc.

For example, when I make the object "chef" there is a line:

document.write("<div id='chefDiv' style='position:absolute; top:"+this.y+"; left:"+this.x+"; z-index:2'><img src="+this.src+" name='chefbmp'></div>");

Then, in a totally different area of the code I try:

document.getElementById('chefDiv').style.top = 200;

... and the location of the chefDiv does not change. However if I try the code:

alert(document.getElementById('chefDiv').style.top);

... it will bring an alert message that says "407px".

What am I doing wrong here? Is there something different about this because I'm using objects and constructors? Or is it because I'm using document.write(....) instead of directly writing the html in the page?

How can I change the aspects of my chefDiv?

Thanks!
Kevin

Reply With Quote
  #2  
Old May 4th, 2004, 07:16 PM
jnsg jnsg is offline
JackOfAllTrades, MasterOfNone
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Kentucky, USA
Posts: 365 jnsg User rank is Sergeant Major (2000 - 5000 Reputation Level)jnsg User rank is Sergeant Major (2000 - 5000 Reputation Level)jnsg User rank is Sergeant Major (2000 - 5000 Reputation Level)jnsg User rank is Sergeant Major (2000 - 5000 Reputation Level)jnsg User rank is Sergeant Major (2000 - 5000 Reputation Level)jnsg User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 31 m 15 sec
Reputation Power: 51
Send a message via AIM to jnsg
Try changing it to document.getElementById('chefDiv').style.top = "200px"

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Trouble combining CSS and JS Objects


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT