才看到你想要的是前台代码, 这是后台的
private string GetWeather(string cityCode)
{
string weather = string.Empty
if (cityCode == "" || string.IsNullOrEmpty(cityCode)) { cityCode = "seoul"}
XmlDocument document1 = new XmlDocument()
document1.Load("http://query.yahooapis.com/v1/public/yql?q=select * from geo.places where text=" + cityCode + "&format=xml")
XmlNodeList nodes1 = document1.GetElementsByTagName("woeid")
string strWoeid = nodes1[0].InnerText
XmlDocument document = new XmlDocument()
document.Load("http://weather.yahooapis.com/forecastrss?w=" + strWoeid + "&u=c")
XmlNodeList nodes = document.GetElementsByTagName("forecast",
@"http://xml.weather.yahoo.com/ns/rss/1.0")
foreach (XmlNode node in nodes)
{
Console.WriteLine("日期:{0},星期:{1},天气:{2},温度:{3}°C 至 {4}°C",
node.Attributes["date"].InnerText,
node.Attributes["day"].InnerText,
node.Attributes["text"].InnerText,
node.Attributes["low"].InnerText,
node.Attributes["high"].InnerText)
//FToC(int.Parse(node.Attributes["low"].InnerText)),
// FToC(int.Parse(node.Attributes["high"].InnerText)))
// //woeid
// // http://query.yahooapis.com/v1/public/yql?q=select * from geo.places where text="Wonju"&format=xml
}
return weather
}
<iframe src=" http://m.weather.com.cn/n/pn14/weather.htm" width="260" height="30" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>天气代码 //日期代码<script language="JavaScript">function number(index1){
var numberstring="一二三四五六七八九十"
if(index1 ==0) {document.write("十")}
if(index1 <10){
document.write(numberstring.substring(0+(index1-1),index1))}
else if(index1 <20 ){
document.write("十"+numberstring.substring(0+(index1-11),(index1-10)))}
else if(index1 <30 ){
document.write("二十"+numberstring.substring(0+(index1-21),(index1-20)))}
else{
document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}
}var today1 = new Date()
var month = today1.getMonth()+1
var date = today1.getDate()
var day = today1.getDay()
number(month)
document.write("月")
number(date)
document.write("日")
</script>