topical media & game development
mashup-amazon-11-11-02-RestaurantBrowser-default.aspx / aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="mapFromRSS" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=[YOUR ID HERE]">
</script>
<script type="text/javascript">
// Create a new map object
var myMap;
var myGeoRSS;
function InitMap(){
myMap= new YMap(document.getElementById('myMap'));
FindFood();
}
function FindFood(){
// Obtain the right city.
var objCity = document.getElementById('ddCity');
var strCityValue = objCity.options[objCity.selectedIndex].value;
var strCityText = objCity.options[objCity.selectedIndex].text;
// Get the cuisine
var objCuisine = document.getElementById('ddCuisine');
var strCuisine = objCuisine.options[objCuisine.selectedIndex].text;
// Get the neighborhood
var strNeighborhood = document.getElementById('txtNeighborhood').value;
// Construct the RSS string
var strRSSSource = "http://mashups.FrancisShanahan.com/getdata.aspx?operation=ItemSearch&ResponseGroup=Large&SearchIndex=Restaurants&xsl=amazonRestaurants.xsl&contentType=text/xml";
strRSSSource += "&Cuisine="+ strCuisine ;
strRSSSource += "&City="+ strCityValue ;
strRSSSource += "&Neighborhood="+ strNeighborhood ;
// Create the overlay
myGeoRSS = new YGeoRSS(strRSSSource);
// Draw the map on the city
myMap.drawZoomAndCenter(strCityText, 4);
// Add the overlay
myMap.addOverlay(myGeoRSS);
}
</script>
<style type="text/css">
#myMap {
height: 600px;
width: 600px;
}
</style>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body onload="InitMap(); ">
<form id="form1" runat="server">
</form>
<div class="siteHeading">
Restaurant Browser</div>
<div class="mainTable">
<h1>
Amazon, Yahoo and GeoRSS combined to find Food</h1>
<table>
<tr>
<td>
<div id="myMap">
</div>
</td>
<td>
<table>
<tr>
<td>
<strong>Choose a City:</strong></td>
<td>
<select id="ddCity" language="javascript" onchange="FindFood()">
<option value="Boston">Boston</option>
<option selected="selected" value="New%20York">New York</option>
<option value="Chicago">Chicago</option>
<option value="San%20Diego">San Diego</option>
<option value="San%20Francisco">San Francisco</option>
</select>
</td>
</tr>
<tr>
<td>
<strong>Cuisine:</strong></td>
<td><select id="ddCuisine" language="javascript" onchange="FindFood()">
<option selected="selected" value="Steak">Steak</option>
<option value="Pizza">Pizza</option>
<option value="French">French</option>
<option value="Seafood">Seafood</option>
</select>
</td>
</tr>
<tr>
<td>
<strong>Neighborhood:</strong></td>
<td>
<input id="txtNeighborhood" type="text" onchange="FindFood()" size="15" value="" /></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.