私は 2 つの JavaScript プログラムを持っています。1 つは以前の会社で使用していたもので、もう 1 つはサイトで見つけたばかりです。今日、同僚がプログラムでこれらの両方の標準を使用していることに気付きました。製品を完成させる前に、すべてを 1 つの標準コードに変更する必要があります。
<script type="text/javascript">
// Reference the textbox
var txt = document.getElementById("<%=txtName.ClientID%>");
// If the textbox was found, call its focus function
if (txt != null)
txt.focus();
</script>
また
<script type="text/javascript">
// Reference the textbox and call its focus function
var txt = $("#txtName");
txt.focus();
</script>
あなたがそのような状況にある場合、どれを提案しますか?なぜですか?