Как совершенствоваться к следующему входу формы, когда текущий вход имеет значение?

Мой подход должен использовать вышеупомянутый плагин для ccnet и задачи эха nant генерировать VersionInfo.cs файл, содержащий только атрибуты версии. Я только должен включать VersionInfo.cs файл в сборку

, задача эха просто производит строку, которую я даю ему файлу.

, Если существует подобная задача MSBuild, можно использовать тот же подход. Вот небольшая nant задача, которую я использую:

<target name="version" description="outputs version number to VersionInfo.cs">
  <echo file="${projectdir}/Properties/VersionInfo.cs">
    [assembly: System.Reflection.AssemblyVersion("$(CCNetLabel)")]
    [assembly: System.Reflection.AssemblyFileVersion("$(CCNetLabel)")]
  </echo>
</target>

Попытка это:

<ItemGroup>
    <VersionInfoFile Include="VersionInfo.cs"/>
    <VersionAttributes>
        [assembly: System.Reflection.AssemblyVersion("${CCNetLabel}")]
        [assembly: System.Reflection.AssemblyFileVersion("${CCNetLabel}")]
    </VersionAttributes>
</ItemGroup>
<Target Name="WriteToFile">
    <WriteLinesToFile
        File="@(VersionInfoFile)"
        Lines="@(VersionAttributes)"
        Overwrite="true"/>
</Target>

Обратите внимание на то, что я не являюсь очень близким с MSBuild, таким образом, мой сценарий не будет, вероятно, работать out-of-the-box и нужен в исправлениях...

33
задан Brian Tompsett - 汤莱恩 24 August 2019 в 16:24
поделиться

2 ответа

you just need to give focus to the next input field (by invoking focus()method on that input element), for example if you're using jQuery this code will simulate the tab key when enter is pressed:

var inputs = $(':input').keypress(function(e){ 
    if (e.which == 13) {
       e.preventDefault();
       var nextInput = inputs.get(inputs.index(this) + 1);
       if (nextInput) {
          nextInput.focus();
       }
    }
});
43
ответ дан 27 November 2019 в 17:43
поделиться
function nextField(current){
    for (i = 0; i < current.form.elements.length; i++){
        if (current.form.elements[i].tabIndex == current.tabIndex+1){
            current.form.elements[i].focus();
            if (current.form.elements[i].type == "text"){
                current.form.elements[i].select();
            }
        }
    }
}

This, when supplied with the current field, will jump focus to the field with the next tab index. Usage would be as follows

<input type="text" onEvent="nextField(this);" />
13
ответ дан 27 November 2019 в 17:43
поделиться
Другие вопросы по тегам:

Похожие вопросы: