框架中的一个页面:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="JavaScript" type="text/javascript">
<!--
var SearchString;
function Search()
{
SearchString = document.SearchFrom.SearchText.value;
}
function GoogleSearchWeb()
{
Search();
if(SearchString != "")
{
SearchUrl = "
http://www.google.com/search?q=" + SearchString;
}
else
{
SearchUrl = "
http://www.google.com/";
}
parent.w.location=SearchUrl;
}
function YahooSearchWeb()
{
Search();
if(SearchString != "")
{
SearchUrl = "
http://search.cn.yahoo.com/search?p=" + SearchString;
}
else
{
SearchUrl = "
http://www.yahoo.cn/";
}
parent.w.location=SearchUrl;
}
//-->
</script>
<body>
<form name="SearchFrom">
<input name="SearchText" type="text" maxlength=100 size="36" value=""/>
<input type="button" name="Submit2" value="Google搜索" onclick="GoogleSearchWeb();"/>
<input type="button" name="Submit3" value="雅虎搜索" onclick="YahooSearchWeb();"/>
</form>
</body>
</html>