How to solve an error in the execution of the input value in a small window

Source: Internet
Author: User
The execution of the force value in a small window is incorrect. The website on www.mredkj.comtutorialstableaddrow.html has an execution representation. I changed the code on the webpage & lt; form... the file name & gt; is used to create a new php file named getval_0403_02.php, but the write value cannot be displayed as it is on the Internet. Which of the following experts can tell you where to rewrite it. An error occurred while executing the force value in the small window.
Http://www.mredkj.com/tutorials/tableaddrow.html

The preceding website has an execution representation. I modified the code on the webpage. ,
Create a new php file named getval_0403_02.php
However, the write value cannot be displayed as on the Internet.

Which of the following experts can tell you where to rewrite it.
Thank you.


Script
// Last updated 2006-02-21
Function addRowToTable ()
{
Var tbl = document. getElementById ('tblsample ');
Var lastRow = tbl. rows. length;
// If there's no header row in the table, then iteration = lastRow + 1
Var iteration = lastRow;
Var row = tbl. insertRow (lastRow );

// Left cell
Var cellLeft = row. insertCell (0 );
Var textNode = document. createTextNode (iteration );
CellLeft. appendChild (textNode );

// Right cell
Var cellRight = row. insertCell (1 );
Var el = document. createElement ('input ');
El. type = 'text ';
El. name = 'txtrow' + iteration;
El. id = 'txtrow' + iteration;
El. size = 40;

El. onkeypress = keyPressTest;
CellRight. appendChild (el );

// Select cell
Var cellRightSel = row. insertCell (2 );
Var sel = document. createElement ('select ');
Sel. name = 'selrow' + iteration;
Sel. options [0] = new Option ('text zero ', 'value0 ');
Sel. options [1] = new Option ('text one', 'value1 ');
CellRightSel. appendChild (sel );
}
Function keyPressTest (e, obj)
{
Var validateChkb = document. getElementById ('chkvalidateonkeypress ');
If (validateChkb. checked ){
Var displayObj = document. getElementById ('spanoutput ');
Var key;
If (window. event ){
Key = window. event. keyCode;
}
Else if (e. which ){
Key = e. which;
}
Var objId;
If (obj! = Null ){
ObjId = obj. id;
} Else {
ObjId = this. id;
}
DisplayObj. innerHTML = objId + ':' + String. fromCharCode (key );
}
}
Function removeRowFromTable ()
{
Var tbl = document. getElementById ('tblsample ');
Var lastRow = tbl. rows. length;
If (lastRow> 2) tbl. deleteRow (lastRow-1 );
}
Function openInNewWindow (frm)
{
// Open a blank window
Var aWindow = window. open ('', 'tableaddrownewwindow ',
'Scrollbars = yes, menubar = yes, resizable = yes, toolbar = no, width = 400, height = 400 ');

// Set the target to the blank window
Frm.tar get = 'tableaddrownewwindow ';

// Submit
Frm. submit ();
}
Function validateRow (frm)
{
Var chkb = document. getElementById ('chkvalidate ');
If (chkb. checked ){
Var tbl = document. getElementById ('tblsample ');
Var lastRow = tbl. rows. length-1;
Var I;
For (I = 1; I <= lastRow; I ++ ){
Var aRow = document. getElementById ('txtrow' + I );
If (aRow. value. length <= 0 ){
Alert ('row' + I + 'is empty ');
Return;
}
}
}
OpenInNewWindow (frm );
}
Script






No title page




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.