技术开发 频道

.NET:如何用JS将百度搜索添加到网站?

  网页代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
    
<title>
</title>
    
<link href="Scripts/StyleSheet.css" rel="stylesheet" type="text/css" />
    
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript">
</script>
    
<script src="Scripts/JScript2.js" type="text/javascript">
</script>
</head>
<body>
    
<form style="text-align: center" id="form1" runat="server">
    
<br />
  
<br />
  
<br />
  
<br />
  
<br />
  
<br />
  
<br />
    
<input style="width:500px;"  url="true" id="Text1" type="text" /><br/>
      
<input style="width:500px;" id="Text2" type="text" />
    
<div style="display: none; position: absolute;" id="allSitesBoxHdl" class="classlist"        onmouseover="this.style.display='block'" onmouseout="this.style.display='none'">
        
<ul id="allSitesBoxContent">
        
</ul>
    
</div>
    
<script type="text/javascript">
        Init();
    
</script>
    
</form>
</body>
</html>

   好了我们一起浏览一下效果吧

  效果还不错吧!说到这里不仅仅是百度这样,像Soso,Sogou等都可以使用同样的方法来实现。

  大家如有兴趣的话可以下载这个例子看看。下载地址:http://files.cnblogs.com/sufei/baiduList.zip

0
相关文章