By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,382 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,382 IT Pros & Developers. It's quick & easy.

<div> display problem

P: n/a
This is a repost under a different subject.
Hi all.

I've been here before and got a lot of help with my neophyte troubles so I'm
back again.

This time I have a number of questions (if I can remember them all).

(I've pasted the code in question at the end of this message and installed it on
the web at http://www3.telus.net/bikim/test .)

Just for something to do I'm attempting to code a menu system that is as
programmable as I can. The first row, that I call the 'base buttons' works
mostly like I expect it to. (So I haven't included it here but you can see what
it does by following the link above.

Q1: The problem I am having is that when I click one of these buttons (a base
button) to generate a column of similar buttons nothing appears. According to
the dom inspector the divs are being created but they just don't appear visually
on the page anywhere that I can find. They have the correct id's and are
attached to the correct parent divs. The code is basically the same thing I did
to generate the first row of 'base' buttons but as columns instead. Am I
missing something pathetically obvious here? I've been fiddling with everything
for a week and the closest I came was when some new buttons appeared scrunched
in behind the original buttons.

Q2: How can I align the text vertically in the div?

Q3: What _were_ the rest of my questions? :-)

------- start of code --------

// FUNCTION :: makeButtons(event)
// this handles the onclick event in a base button
// i.e. onclick = makeButtons
// Use :: supply num 'buttons'
// Receives :: number of buttons to make as int <from button clicked?>
// :: type of container to use
// Returns :: status as bool

function makeButtons(event)
{
// get parent-Button-id
var obj = event.target;
var targetId = obj.id;
var idPostfix = targetId.charAt(1);
var idBase = parseInt(targetId);
//var iD = this.id;
for(var i=0; i<=rows; i++) // get rows from functions.js
{
var bTemp = makeEl('div'); // button temp

bTemp['id'] = (i+idBase+1)+idPostfix; // from variables ???

bTemp.style.position = 'relative';
bTemp.style.left = obj.style.left;
bTemp.style.top = (parseInt(obj.style.top)+(25*(i+1)))+'px';
bTemp.style.width = 100+"px";
bTemp.style.backround = bgImg;
document.getElementById(targetId).appendChild(bTem p);
}

var mesg = '';
// mesg += 'this.id = '+pBid;
mesg += '\ntarget Id = '+targetId;
mesg += '\ntarget Id as int= '+parseInt(targetId);
mesg += '\nbTemp Id = '+bTemp["id"];
mesg += '\nidPostfix = '+idPostfix;
mesg += '\nidBase = '+idBase;
mesg += '\nobj.style.left = '+obj.style.left;
mesg += '\nobj.style.top = '+obj.style.top;
mesg += '\nbTemp.style.top = '+(parseInt(obj.style.top)+25)+'px';

alert('In makeButtons \n'+mesg);
return 'false';
}
// end of FUNCTION :: makeButtons()

---------- End of Code Snippet ----------
Thanks
--

Phil Newcombe - philn?telus?net

http://www3.telus.net/bikim

Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Phil N wrote:
This is a repost under a different subject.

where the post of the day before has been answered

http://www.jibbering.com/faq/#FAQ2_4

Jul 20 '05 #2

P: n/a
Dom Leonard wrote:
Phil N wrote:
This is a repost under a different subject.


where the post of the day before has been answered

http://www.jibbering.com/faq/#FAQ2_4


Thanks - sorry didn't catch the other reply for some reason.
--
Phil Newcombe - philn?telus?net

http://www3.telus.net.bikim

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.