Topic: createElement("div") + IE? (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 14:31
In regards to the following code, is it normal that IE doesnt support this feature, or am I simply doing something wrong? This code works in Firefox. Am I forced to make a second version which writes elements using innerHTML ? code: divHandler = createDiv("corner4",10,30,30,30,null,null,50); document.body.appendChild(divHandler); function createDiv(name,left,top,width,height,background,onmouseup,zIndex) { divHandle = document.createElement("div"); divHandle.style.position = "absolute"; divHandle.style.top = top + "px"; divHandle.style.left = left + "px"; divHandle.style.width = width + "px"; divHandle.style.height = height + "px"; if(zIndex) divHandle.style.zIndex = zIndex; if(background) divHandle.style.background = background; if(onmouseup) divHandle.style.onmouseup = onmouseup; return divHandle; } |
Paranoid (IV) Inmate From: Norway |
posted 04-18-2006 14:41 |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 14:55
Thanks for the speedy reply p01 |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 15:15
Found this recently p01, seems like your kinda bag |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 04-18-2006 15:16
BTW divHandle.style.onmouseup = onmouseup |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 15:45
Well spotted, unfortunatly that wasnt the problem. |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 15:49
The IE debugger says |
Paranoid (IV) Inmate From: Norway |
posted 04-18-2006 17:01
I've got the same error as you in IE code: javascript:alert( divHandle );void( 0 ); I get an array with 5 Objects, as expected, but when I do : code: javascript:alert( i );void( 0 ); it says [ object ] while it should display a number between 0 and 5. |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 17:52
Oh christ, I have a form named i for input, I've been wrecking my head over this for ages, thanks man ! |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-18-2006 19:50 |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-19-2006 01:08
I have yet another problem now : code: divHandle.onmouseup = dothis();
code: divHandle.onmouseup = dothis(this.id);
|
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-19-2006 01:11
is it possible to access a div's parent? |
Paranoid (IV) Inmate From: Norway |
posted 04-19-2006 01:48
[quickReply_that_might_need_cross_browser_hacks_in_crappy_browsers] code: function dothis( evt ) { var evt = evt||event, element = evt.target||evt.srcElement||this; alert( element.id +'\n'+ element.parentNode ) } divHandle.onmouseup = dothis; /!\ the code above is probably not 100% correct, but I can't be bothered to check it at ~2 o'clock after a few beers and before a short night. |
Bipolar (III) Inmate From: Sweden |
posted 04-19-2006 05:29
Haha gotta love IE |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-19-2006 18:11
Hadn't even thought of an event ! Many thanks again, ye see this to be an interface for a final year project, so 1 thanks = 20+ regular thankss. I'm gonna keep an eye out see if I can help you with anything in further posts, although I think you completely out rank me in any progamming way |
Paranoid (IV) Inmate From: Dublin, Ireland |
posted 04-19-2006 19:05
It works just fine btw ! |