Hi,
I have the following Javascript code for loading my Google custom search:

Search = '<form action="http://www.ututorial.net/search" id="cse-search-box"><div><input type="hidden" name="cx" value="partner-pub-3996237323979957:tenb6ft9bbh" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="ISO-8859-1" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>';
function set() {
	document.getElementById('Search_Content').innerHTML = Search;
}

This works fine in Firefox but in IE i get 'error on page' warning and the box doesn't load. Is this a bug in IE or a code problem?
Regards,
Sam Rudge

search = '<form action="http://www.ututorial.net/search" id="cse-search-box"><div><input type="hidden" name="cx" value="partner-pub-3996237323979957:tenb6ft9bbh" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="ISO-8859-1" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></&#115 ;&#99 ;&#114 ;&#105 ;&#112 ;&#116 ;>'; /* hex has been exploded, spaces added, Daniweb does not allow the hex to sit as typed but echoes the character, bad for this, good to reduce code injections */
function set() { document.getElementById('Search_Content').innerHTML = search; }

the hex is 'script' which when written out by javascript should work

commented: Thanx for the help +1

Try to use id's that starts in a lower case, and apply this code to ensure that it will execute in IE browsers.

function s_et()
{ var ua = (document.all) ? document.all.search_content : document.getElementById('search_content');
   if ( ua ) 
   ua.innerHTML = search; 
}

Hi,
Thanx almostbob, although your solution didn't actualy solve the problem, you helped me find out how to fix it myself.

Have no idea what it was, but cool,
what was the solution?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.