在博客上设置一个引导搜索框

时间:2015-07-20 14:34:45

标签: twitter-bootstrap blogger search-box

我正在尝试将我的网页导航栏从 Blogger 默认替换为bootstrap。我修改了示例,只在导航栏中有一个搜索框,但没有搜索。我该怎么办?

type  
  TForm1 = class(TForm)
    [...]
    VixLib : IVixLib;
    Job : IJob;
    Host : IHost;
    VM : IVM;
    Err : Int64;
    vWaitParams : OleVariant;
    vResults : OleVariant;
    vValue : OleVariant;
    Msg : String;
  end;
[...]
procedure TForm1.GetUserName;
begin
  // Prior to calling this code, you need to have successfully called
  // LogInGuest on the VM via Vix
  // change USERNAME to USERDOMAIN in the following line to get the domain
  Job := VM.ReadVariable(VIX_GUEST_ENVIRONMENT_VARIABLE, 'USERNAME', 0, Nil);
  vWaitParams := VarArrayOf([VIX_PROPERTY_JOB_RESULT_VM_VARIABLE_STRING]);
  Err := Job.Wait(vWaitParams, vValue);
  if Err <> 0 then
    raise Exception.Create('Error %d', [Err]);

  Msg := vValue[0];
  Caption := Msg;
end;

http://jsfiddle.net/ariloc/auu1L19k/6/

2 个答案:

答案 0 :(得分:1)

Ari Fi。您需要为博主搜索添加更多属性才能正常工作。

<form>添加method="get" action="/search"
<input>添加name='q'

请参阅下面的代码

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <form  method="get" action="/search" class="navbar-form navbar-left" role="search">
      <div class="form-group">
        <input name='q' type="text" class="form-control" placeholder="Search"></input>
      </div>
      <button type="submit" class="btn btn-default">Submit</button>
    </form>
  </div>
</nav>

答案 1 :(得分:0)

您忘记了表单方法和操作的一些重要部分。试试这个:

<nav class="navbar navbar-default">
    <div class="container-fluid">
        <form id="searchbox" method="get" action="/search" autocomplete="off" class="navbar-form navbar-left" role="search">
            <input name='q' type="text" type="text" class="form-control" placeholder="Search" />
            <button id="button-submit" type="submit" value=" " class="btn btn-default" />
        </form>
        </div>
</nav>