www.webdeveloper.com
Results 1 to 3 of 3

Thread: Appending new elements to document

  1. #1
    Join Date
    Oct 2003
    Location
    Pensacola, Fl
    Posts
    149

    Appending new elements to document

    I've searched through the forum and found related posts where other people have had this problem, but I haven't found any solutions that have worked for me. I've disabled my XSS filtering in IE, as well as enabled scripts to run, but for some reason I'm still not able to append new elements to a page. At first I worked with iframes, but I changed to working DIVs. I've found that I have the same problem...I just can't append new elements. What I'm trying to do is write an external file script into my index page that has the DIV with the text that I want to change. Has anyone had this same problem before?
    Your friendly neighborhood Okham. -o-o-

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,391
    Give an example of what you have attempted thus far...

  3. #3
    Join Date
    Oct 2003
    Location
    Pensacola, Fl
    Posts
    149
    Hey JMRKER...well, what I've tried so far has been pretty straightforward. I created a DIV on my index page, then called function showitem(), and in the function all I want to do is write the script to the index page so I can fill the innerHTMLs. Here's the function:

    Code:
    function showitem(imgtype)
    {
    	document.getElementById('showitem').style.display='block';jumpdesno=lookno;
    	switch(imgtype)
    	{
    		case "design": 
    			lookpath="items/designs/des"+jumpdesno+".js";
    			lookpic.src="pics/designs/design"+jumpdesno+".gif";
    		break;
    		default: break;		
    	}
    	e=document.createElement('script');
    	e.setAttribute('src',lookpath);
    	e.type="text/javascript";
    	document.getElementByTagName('head')[0].appendChild(e);
    	document.getElementById('desnum').innerHTML='test';
    }
    So far I haven't been able to write the script, and if "test" shows up in my text field then I know it's writing in my values. For now it doesn't seem to be working. One last thing, this function is in an external .js file I include on the index head. If you've got any suggestions, feel free to go ahead. I don't know what else to try...lol
    Your friendly neighborhood Okham. -o-o-

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles