Yazeka
Arama sonuçlarına göre oluşturuldu
VBScript'te forma eklemek için aşağıdaki adımlar izlenir:
- Form Oluşturma: HTML'de
<form>
etiketi kullanılarak form oluşturulur ve bu formun kapanması için<form>
kapanış etiketi eklenir 23. - Kontrol Ekleme: Formun içine
<input>
etiketi kullanılarak metin kutusu, düğme gibi kontroller eklenir 24. Bu kontrollere isim ve tip atanmalıdır 24. - Kod Yazma: Form ve kontrollere erişmek ve işlemleri gerçekleştirmek için VBScript kodu yazılır 13. Bu kodda, formun adı
document.form_adı
şeklinde kullanılarak kontrollere ulaşılabilir 13.
Örneğin, basit bir doğrulama işlemi için:
<form name="ValidForm"> Enter a value between 1 and 10: <input name="Text1" type="text" size="2"> <input name="Submit" type="button" value="Submit"> </form>
Bu kodu VBScript ile birleştirmek için:
Sub Submit_OnClick Dim TheForm Set TheForm = Document.ValidForm If IsNumeric(TheForm.Text1.Value) Then If TheForm.Text1.Value < 1 Or TheForm.Text1.Value > 10 Then MsgBox "Please enter a number between 1 and 10." Else MsgBox "Thank you." End If Else MsgBox "Please enter a numeric value." End If End Sub ``` [1](https://www.csidata.com/custserv/onlinehelp/VBSdocs/VBS1.HTM)[3](https://documentation.help/MS-Office-VBScript/vbscntrl.htm).
5 kaynaktan alınan bilgiyle göre: