コード例 #1
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputTime creates a time based input box
func InputTime(id string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "time"
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #2
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputColor creates a colour based input box, the workings of which are
// implementation specific
func InputColor(id string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "color"
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #3
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputMonth creates a month based input box
func InputMonth(id string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "month"
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #4
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputWeek creates a week based input box
func InputWeek(id string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "week"
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #5
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputUpload creates an upload input field
func InputUpload(id string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "file"
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #6
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputDateTimeLocal create a local datetime based input, the workings of
// which are implementation specific
func InputDateTimeLocal(id string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "datetime-local"
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #7
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputURL is a text box that validates as a URL
func InputURL(id, value string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "url"
	i.Value = value
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #8
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputPassword creates a password input
func InputPassword(id, value string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "password"
	i.Value = value
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #9
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputButton creates a button input
func InputButton(id, name string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "button"
	i.Value = name
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #10
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputCheckbox creates a checkbox input
func InputCheckbox(id string, value bool) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "checkbox"
	if id != "" {
		i.SetID(id)
	}
	i.Checked = value
	return i
}
コード例 #11
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputText creates a text input box
func InputText(id, value string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "text"
	if id != "" {
		i.SetID(id)
	}
	i.Value = value
	return i
}
コード例 #12
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputRadio create a radio button input
func InputRadio(id, name string, value bool) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "radio"
	i.Name = name
	if id != "" {
		i.SetID(id)
	}
	i.Checked = value
	return i
}
コード例 #13
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputNumber creates a text input that only allows number to be entered
func InputNumber(id string, min, max, value float64) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "number"
	i.Min = strconv.FormatFloat(min, 'f', -1, 64)
	i.Max = strconv.FormatFloat(max, 'f', -1, 64)
	i.ValueAsNumber = value
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #14
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputRange creates a sliding rule with which a number in the given range
// can be selected
func InputRange(id string, min, max, step, value float64) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "range"
	i.Min = strconv.FormatFloat(min, 'f', -1, 64)
	i.Max = strconv.FormatFloat(max, 'f', -1, 64)
	i.Value = strconv.FormatFloat(value, 'f', -1, 64)
	if step != step {
		i.Step = "all"
	} else {
		i.Step = strconv.FormatFloat(min, 'f', -1, 64)
	}
	if id != "" {
		i.SetID(id)
	}
	return i
}
コード例 #15
0
ファイル: form.go プロジェクト: MJKWoolnough/gopherjs
// InputSubmit creates a submit input
func InputSubmit(name string) *dom.HTMLInputElement {
	i := xdom.Input()
	i.Type = "submit"
	i.Value = name
	return i
}