[thelist] writing new javascript into html page

david currey dave at state51.co.uk
Mon Feb 17 14:02:01 CST 2003


hi,

  i am trying to write some new javascript into a page after it has
loaded.
I can get it going in most browsers and have to fork the script for
macIE, but no matter what i do i cant get anything at all to happen
with safari.

has anyone got any clues how to get this happening with khtml?


// this works with everything i need except macIE and safari

	theid="relatedscr";
	sc=document.createElement('script');
	sc.setAttribute('src',url) ;
	sc.setAttribute('id',theid);
	document.getElementsByTagName('head')[0].appendChild(sc);

// this works with mac ie 5

obj=document.createElement("DIV");
//obj.innerHTML='<script type="text/javascript"
src="'+url+'"><\/script>';
document.body.appendChild(obj);

cheers,

dave




More information about the thelist mailing list