第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

關(guān)于按鈕提交跳轉(zhuǎn)不了問(wèn)題

視頻只教了提示框點(diǎn)擊提交,按鈕提交跳轉(zhuǎn)不了是出了什么問(wèn)題

<div class="bg-div"> ?

?<div class="search_box">

?<form action="" method="get" id="search_form"> ? ?

<input type="text" class="search_text" name="q" id="search_input" autocomplete="off" ?value="" />

<input type="submit" class="search_button" id="searchButton" value="" />

</form>?

</div>

</div>


<!-- 提示 -->

<div class="suggest" id="search_suggest" style="display:none;">

? ?<ul id="search_result">

? ? ? <li>搜索結(jié)果1</li>

? ? ? <li>搜索結(jié)果2</li>?

? ?</ul>?

</div>

<script>

?$(function(){

? ? ?$('#search_input').on('keyup',function(){

? ? ? var searchText = $('#search_input').val();

? ? ? $.ajax({

? ? ? ? url: 'http://api.bing.com/qsonhs.aspx?type=cb&q='+searchText, //當(dāng)前頁(yè)地址。發(fā)送請(qǐng)求的地址。

? ? ? ? type: 'get',

? ? ? ? async:true, //默認(rèn)值: true。默認(rèn)設(shè)置下,所有請(qǐng)求均為異步請(qǐng)求。如果需要發(fā)送同步請(qǐng)求,請(qǐng)將此選項(xiàng)設(shè)置為 false。

? ? ? ? dataType: 'jsonp',//預(yù)期服務(wù)器返回的數(shù)據(jù)類型

? ? ? ? jsonp:'cb',//在一個(gè) jsonp 請(qǐng)求中重寫回調(diào)函數(shù)的名字

? ? ? ? jsonpCallBack:'callback', ? ? ? ?

? ? ? ? success:function(d){ //當(dāng)請(qǐng)求之后調(diào)用

? ? ? ? ? var d = d.AS.Results[0].Suggests;

? ? ? ? ? var html = '';

? ? ? ? ? for(var i=0; i<d.length; i++){

? ? ? ? ? ? html+='<li>'+d[i].Txt+'</li>';

? ? ? ? ? }

? ? ? ? ? $('#search_result').html(html);

? ? ? ? ? ? $("#search_suggest").show().css({

? ? ? ? ? ? ? ? top:$("#search_form").offset().top+$("#search_form").height()+10,

? ? ? ? ? ? ? ? left:$("#search_form").offset().left,

? ? ? ? ? ? ? ? position:"absolute"

? ? ? ? ? ? });

? ? ? ? ?},

? ? ? ? ?error:function (){ //在請(qǐng)求出錯(cuò)時(shí)調(diào)用

? ? ? ? ? ? console.log("失敗");

? ? ? ? }

? ? ? })

? ?});?

? $(document).bind('click',function(){

? ? ? ?$("#search_suggest").hide();

? });

//提示框點(diǎn)擊提交 ?

$('#search_result').on('click','li',function(){

? ? ?var keyword = $(this).text();

? ? ?location.+keyword;

? })

//按鈕提交 ?

$('#searchButton').on('click',function(){

? ? ?var keytext = $('#search_input').val();

? ? ?location.+keytext;

? })


}) ? ? ?

</script>



正在回答

1 回答

舉報(bào)

0/150
提交
取消
搜索框制作
  • 參與學(xué)習(xí)       66019    人
  • 解答問(wèn)題       463    個(gè)

本課程從簡(jiǎn)入深講解搜索框的制作,學(xué)習(xí)JQ與JS實(shí)現(xiàn)Ajax技術(shù)的不同點(diǎn)

進(jìn)入課程

關(guān)于按鈕提交跳轉(zhuǎn)不了問(wèn)題

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)