1

オートコンプリートの結果として、検索テキストボックスの値を次のページに移動しようとしています。ただし、検索ボックスに入力された値のみが取得されます。

私が使用しているコードは次のとおりです。

function fill(thisValue) {
        var abc = $('#search').val(thisValue);
        alert(abc);
        $('#rad').show();
        setTimeout("$('#suggestions').hide();", 200);
        document.getElementById("Form1").submit();
    }

html:

<form action="<?php echo $mainUrl?>/search" method="post" name="Form1" id="Form1" onsubmit="if( ( document.getElementById( 'search' ).value === '' ) || ( document.getElementById( 'search' ).value === 'Search billions of items at the single Platform' ) ){ document.getElementById( 'search' ).focus(); return false;};">
                <input type="text" name="search" placeholder="Search billions of items at the single Platform" id="search" onkeyup="lookup(this.value);" onblur="fill();" autocomplete='off' value="" />
                <input type="submit" name="submit_btn" value="search" class="button" id="button"   />
                <div class="suggestionsBox" id="suggestions" style="display: none;">
                <img src="<?php echo $mainUrl?>/resources/autocomplete/autoComplete/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
                <div class="suggestionList" id="autoSuggestionsList">


and html

<input type="text" name="search" placeholder="Search billions of items at the single Platform" id="search" onkeyup="lookup(this.value);" onblur="fill();" autocomplete='off' value="" />

これに関する提案は高く評価されます

4

1 に答える 1

1

それはあなたが呼んでいるからですabc

警告したい場合はthisValue、次のように記述します。

alert(thisValue);

次のページに値を表示するには、次を使用できます。

<form action="search.php" method="POST">
  <input type="text" name="search">`
  <input type="sbubmit" value="search">`
</form>

そして、検索PHPで検索値を取得するには:

<?php
  $searchValue = $_POST["search"];`
  echo $searchValue;`
?>
于 2013-02-22T15:02:26.023 に答える