< Script >
Document. Body. onload=TT;
FunctionTT ()
{
Alert ('ddddddddd ');
}
VaRB;
FunctionTe ()//Onselect event
{
B=1;
}
Function A () // Onmouseup event
{
If (B = 1 ){
Alert (document. selection. createRange (). Text );
B = 0 ;
}
}
</ Script >
< Body Onselect = "Javascript: Te ();" Onmouseup = "Javascript: ();" >
Onselectstart = "alert ('start ');"
Onmouseup = "alert (document. selection. createRange (). Text );"
// Firefox uses window. getselec ()
Only when the web page is tested and tested is killed
< BR >
Dddddddddddddd
< Script Language = "JavaScript" >
Function Seltext (){
Document. selection. createRange ();
Document. All. testtext. Value = Unescape (document. selection. createRange (). Text );
Alert ( " Width on the left side of the selection area: " + Document. selection. createRange (). boundingleft );
Alert ( " Height above the constituency: " + Document. selection. createRange (). boundingtop );
Alert ( " Selected area height: " + Document. selection. createRange (). boundingheight );
Alert ( " Selection width: " + Document. selection. createRange (). boundingwidth );
}
</ Script >
< Input Type = "Text" ID = "Testtext" Name = "Testtext" Value = "" Accesskey = "" >
< Input Type = "Button" Name = "Btntest" Value = "Test" Onclick = "Seltext ()" >
< HR >
Object: Document. selection. createRange (); The textrange object is returned.<BR>
Textrange attributes<BR>
Boundingheight gets the height of the rectangle bound to the textrange object. < BR >
Boundingleft gets the distance between the left side of the rectangle bound to the textrange object and the left side of the rectangle containing the textrange object. < BR >
Boundingtop gets the distance between the top edge of the bound textrange object and the top edge that contains the textrange object. < BR >
Boundingwidth retrieves the width of the rectangle that bounds the textrange object. < BR >
Htmltext gets the width of the rectangle bound to the textrange object. < BR >
Offsetleft obtains the left position of the object relative to the layout or the parent coordinate specified by the offsetparent attribute. < BR >
Offsettop obtains the top position of an object relative to the layout or the parent coordinate specified by the offsettop attribute. < BR >
Set or retrieve text in the range of text. < BR >
</ Body >