Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    0x3
    0x3 is offline
    New Coder
    Join Date
    Sep 2013
    Posts
    37
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Internet Explorer

    Quote Originally Posted by xelawho View Post
    I would think that you would want to append the new object once it has been created...

    Code:
    function changeObject(path) { 
    var element = document.getElementById("pdfobject"); 
    var thenode = element.parentNode;
    thenode.removeChild(element); 
    var newObj = document.createElement('object'); 
    
    var IE = !+"\v1"; 
    if(IE){ 
    newObj.id = 'pdfobject';
    newObj.data = path;
    newObj.width = 440;
    newObj.height = 330;
    newObj.type = 'application/pdf';
    } 
    else{ 
    newObj.setAttribute("id", "pdfobject"); 
    newObj.setAttribute("data", path); 
    newObj.setAttribute("width", "440"); 
    newObj.setAttribute("height", "330"); 
    newObj.setAttribute("type", "application/pdf"); 
    } 
    thenode.appendChild(newObj);
    }
    You're correct; the example i did was incomplete, he needed to append the new element to the node. But mind you the code i posted was just a couple second tweak ;p

  2. Users who have thanked 0x3 for this post:

    hunter1611 (09-09-2013)

  3. #17
    New Coder
    Join Date
    Jan 2011
    Posts
    51
    Thanks
    18
    Thanked 0 Times in 0 Posts
    EDIT: Ok..trying that

  4. #18
    New Coder
    Join Date
    Jan 2011
    Posts
    51
    Thanks
    18
    Thanked 0 Times in 0 Posts
    Awesome, it worked. Thank you! Sorry I didn't know more of what I was doing. XD


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •