Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

   

Reply
 
LinkBack Thread Tools Display Modes
Old 02-03-2007, 10:10 PM   #1 (permalink)
Contributing Member
 
Join Date: 12-14-05
Posts: 109
iTrader: 0 / 0%
Latest Blog:
None

gnznroses is on the right pathgnznroses is on the right path
Unhappy relocating a div -- works in IE, FF as usual gets it wrong

i'm using a closed-source script, it uses different template files for different sections of your site. it uses variables that only work in certain template files, effectively limiting what info you can put where. i found a workaround, with a javascript that relocates a div as the child of another div (the destination area). anyone know how i can get something similar working in FF?


here's that i'm using:

(in a .js)
function addElement() {
var ni = document.getElementById('StatusBarHolder');
var newdiv = document.getElementById('StatusBar');
ni.appendChild(newdiv);
newdiv.style.display = 'block';
}


i'm calling this from my header template file as such:
<body bgcolor="#5e818e" onLoad="addElement()">

(on pages where the statusbar div does not exist i get a js error, but that's a different, smaller problem)


works like this:
in my navbar template file:
<div id="selectedPrizeHolder" align="right"> </div>

and then in my statusbar template file:
<div id="statusbar" style="display:none;">
...content
</div>


as i said, works perfect in IE: the statusbar div appears inside my navbar. in FF tho it doens't appear anywhere at all (even tho the js also sets it as visible).

i really need this to work so any help would be appreciated.
gnznroses is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-04-2007, 12:50 PM   #2 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 310
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
id's are case-sensitive

var newdiv = document.getElementById('StatusBar');
<div id="statusbar" style="display:none;">

You're trying to get the element 'StatusBar', but it doesn't exist. However there is an element named 'statusbar'. Pick one or the other and stick with it.

To fix the error when your status bar doesn't exist, change your function to this:
Code:
function addElement() { var ni = document.getElementById('StatusBarHolder'); var newdiv = document.getElementById('StatusBar'); if (newdiv != null) { ni.appendChild(newdiv); newdiv.style.display = 'block'; } }
__________________
~exam~
exam is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-04-2007, 02:08 PM   #3 (permalink)
Contributing Member
 
Join Date: 12-14-05
Posts: 109
iTrader: 0 / 0%
Latest Blog:
None

gnznroses is on the right pathgnznroses is on the right path
ah, thanks. i'dve never caught that case-sensitive problem.
i realized i quoted the wrong thing in one of my examples above, but you still got it right.
have a prob in FF now where the div isn't right-aligned like i want, but i can probably sort that.
gnznroses is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-04-2007, 02:26 PM   #4 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 310
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
Instead of align="right" you could try style="float:right;"
__________________
~exam~
exam is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-04-2007, 04:15 PM   #5 (permalink)
Contributing Member
 
Join Date: 12-14-05
Posts: 109
iTrader: 0 / 0%
Latest Blog:
None

gnznroses is on the right pathgnznroses is on the right path
actually, when i use float, it's not right-aligned in even IE.
i had to use both a div and a table in order to get the status area vertically centered. here's what i've got:


<!-- start main section -->
<table width="616" cellspacing="0" cellpadding="0" border="0">
<tr><td width="616">

<div style="width:616px; height:109px; background-image:url(images/header.gif);" align="right">
<table border="0" cellspacing="0" cellpadding="0"><tr><td height="107" valign="middle" align="center"><div id="StatusBarHolder" style="width:350px; margin-right:20px;"> </div></td></tr></table>

.... buncha page content

</td></tr></table>



-edit-
aha, had to do this:
<div id="StatusBarHolder" style="width:350px; margin-right:20px; text-align:center;" align="right">


i have yet another problem with FF but i'll try to figure it out some more before posting it...
gnznroses is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong Traffic, Wrong Keyword for Wrong Site! Jonathan_Hue SEO Forum 22 03-18-2008 06:33 PM
where is the usual placceyou bought your clothes? potchie Forum Lobby 8 06-05-2007 10:08 AM
Promotion Advice 'Por Favor' (As usual) skyraider Marketing Forum 8 03-24-2004 02:44 PM
Usual question: Which dedicated for my needs...? potiron Dedicated Servers 3 02-09-2004 03:30 PM


Sponsor Links
Webmaster Forum Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 02:49 AM.
© Copyright 2008 V7 Inc