Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass value

Status
Not open for further replies.

xbl12

Programmer
Dec 12, 2006
66
Hi;

I am try to write a program for website search.

I want my home page will display Australia news when user come in, and when user click a link, it will bring out new zealand news and display in the home page, But i could not do that, could anyone help me, please, thanks.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns=" <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google AJAX Search API Sample</title>
<script src=" type="text/javascript"></script>
<script type="text/javascript">
/*
* How to do a search that returns the max number of results per page.
*/

google.load('search', '1');

function OnLoad(mystr) {


// create a search control
var searchControl = new google.search.SearchControl();

// Set the Search Control to get the most number of results
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);

// Create 2 searchers and add them to the control
searchControl.addSearcher(new google.search.WebSearch());
searchControl.addSearcher(new google.search.BlogSearch());

// Set the options to draw the control in tabbed mode
var drawOptions = new google.search.DrawOptions();
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);

// Draw the control onto the page
searchControl.draw(document.getElementById("content"), drawOptions);

// Search!
searchControl.execute(mystr);
}
google.setOnLoadCallback(OnLoad("australia news"));
</script>
</head>

<a href="index.php?search=new zealand news" onClick="onLoad("new zealand News")">new zealand news</a>


<body style="font-family: Arial;border: 0 none;">
<div id="content">Loading...</div>
</body>
</html>
 
Remember JavaScript is case-sensitive. You are calling a function called 'onLoad' but the function is actually called 'OnLoad'.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Thanks, i have known how to do it now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top