windowreference is a valid way of referring to a window, as described in the window object.
property of
描述
the length property is an integer that specifies one of the following:
length is always a read-only property.
for a null string, length is zero. for a select object, the values returned by form 5 and form 14 of the 语法 are the same. for a window containing frames, the values returned by form 7 and form 12 of the 语法 are the same. for a form object, the values returned by form 1 and form 9 of the 语法 are the same. for a frame containing frames, the values returned by form 2 and form 11 of the 语法 are the same.
例子
in the following example, the getchoice() function uses the length property to iterate over every element in the musictype array. musictype is a select element on the musicform form.
function getchoice() {
for (var i = 0; i < document.musicform.musictype.length; i++) {
if (document.musicform.musictype.options[i].selected == true) {
return document.musicform.musictype.options[i].text
}
}
}
the following example displays 8 in an alert dialog box:
var x="netscape"
alert("the string length is " + x.length)
link method
creates an htm hypertext link that jumps to another url.
语法
linktext.link(hrefattribute)
linktext is any string or a property of an existing object.