Common table operations Js for websites

Source: Internet
Author: User

1. Pass the value between frames:

Function ddlchangeid_onhanged (OBJ ){

VaR FF = Document. Forms [0];

// Obtain all frames
VaR objframes = parent. frames;
VaR changevalue = obj. value;

// Get frame 1, a text box
VaR obj_jan = objframes%02.16.doc ument. getelementbyid ("saleinputarea1_txtinputjanid ");


If (changevalue! = ""){
// Set the text box in another framework to writable.
Obj_jan.readonly = false;
// Set the class of the style in the text box
Obj_jan.classname = "textbox0w ";
Obj_jan.value = "";

// Set the buttons of the current framework to be available.
Ff. btninput. Disabled = false; // log on to Alibaba Cloud
}
Else
{

Obj_jan.classname = "textbox0r ";
Obj_jan.readonly = true;

Ff. btninput. Disabled = true; // log on to Alibaba Cloud
}
}
2. Table
/*
* Double-click the function called by the selected row, and fill some data of the selected row in the text box that makes a fram
Rowobj: Row object of table
Rowindex: row number
*/

Function gridrowdblclick (rowobj, rowindex)
{
VaR objframes = parent. frames;
VaR obj_jan = objframes%02.16.doc ument. getelementbyid ("saleinputarea1_txtinputjanid ");
VaR obj_mac = objframes%02.16.doc ument. getelementbyid ("saleinputarea1_txtmac ");
VaR obj_xian = objframes%02.16.doc ument. getelementbyid ("saleinputarea1_txtxian ");

VaR FF = Document. Forms [0];
VaR rtnvalue = "";
VaR rtnarray = new array ();

Obj_jan.readonly = true;
Obj_jan.classname = "textbox0r ";
Obj_jan.value = rowobj. cells [1]. innerhtml; // The subscript of cells starts from scratch.

Obj_mac.readonly = true;
Obj_mac.classname = "textbox0r ";
Obj_mac.value = rowobj. cells [2]. innerhtml;



// Obtain detailed information through backend Ajax (db operation)
Rtnvalue = getreturngoodsdetail (rowobj. cells [0]. innerhtml );

If (rtnvalue! = "")
{
Obj_xian.value = rtnvalue

}

Gridrowonmouseselected (rowobj, rowindex); // record the selected row and set its style



}
/*
* Events when the mouse leaves the selected row
*/
Function gridrowonmouseselected (rowobj, rowindex)
{// Obtain the table object

VaR parentobj = rowobj. parentnode;

// Alert (parentobj. innerhtml );

If (selectedrowid> = 0)
{
Parentobj. Rows [selectedrowid]. classname = "gridonmouseout ";
}

Rowobj. classname = "gridonmouseselected"; // class of the row
Selectedrowid = parseint (rowindex, 10) + 1;
}

3. keyboard listening events
Required parameter Doc ument. onkeydown = inpcodetoform2;
Flagf01 = true;
Flagf02 = true;
// When necessary, you cannot perform manual operations.
Function inpcodetoform (){
If (parent.kaiten_center.doc ument. getelementbyid ("kyousei ")){
// Enter the internal management site
If (flagf02 ){
If (event. keycode = "115 "){
Killevent ();
Parent.kaiten_center.doc ument. getelementbyid ('inputjan '). Focus ();
}
} Else {
If (event. keycode = "115 "){
Killevent ();
}
}
} Else {
// Merged rows in the pay-as-you-go table
If (flagf01 ){
If (event. keycode = "115 "){
Killevent ();
Parent.kaiten_left.doc ument. getelementbyid ('inputjan '). Focus ();
}
} Else {
If (event. keycode = "115 "){
Killevent ();
}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.