Topic: createElement("div") + IE? (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() 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 |
![]() |
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() Thanks for the speedy reply p01 |
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() Found this recently p01, seems like your kinda bag |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() BTW divHandle.style.onmouseup = onmouseup |
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() Well spotted, unfortunatly that wasnt the problem. |
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() The IE debugger says |
Paranoid (IV) Inmate From: Norway |
![]() 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 |
![]() 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 |
![]() |
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() I have yet another problem now : code: divHandle.onmouseup = dothis();
code: divHandle.onmouseup = dothis(this.id);
|
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() is it possible to access a div's parent? |
Paranoid (IV) Inmate From: Norway |
![]() [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 |
![]() Haha gotta love IE |
Paranoid (IV) Inmate From: Dublin, Ireland |
![]() 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 |
![]() It works just fine btw ! |