hurjo
Programmer
- May 1, 2009
- 2
hi, iv tried the following for a couple of days everytime changing some code here and there in vain...any help is accepted...the problem right now is that nothing gets executed it seems...
im trying to add a dynamic script tag that uses google search api...
im trying to add a dynamic script tag that uses google search api...
Code:
var head = document.commandDispatcher.focusedWindow.document.getElementsByTagName("head");
var s = document.createElement("script");
s.type = "text/javascript";
s.src= '[URL unfurl="true"]http://www.google.com/jsapi';[/URL]
var ccc = '<script language="Javascript" type="text/javascript">
google.load("search", "1");
function OnLoad() {
var searchControl = new google.search.WebSearch();
searchControl.execute("hello");
searchControl.setSearchCompleteCallback(null,
function gotResults(){
var url = searchControl.results[0].url;
window.open(url);
}
);
}
google.setOnLoadCallback(OnLoad);
</script>';
s.innerhtml += ccc;
head[0].appendChild(s);