You are here: Reference > JavaScript > client-side > event handling > events > onrowsinserted

onrowsinserted event | rowsinserted event

Browser support:
Occurs on a data source object when rows have been inserted.
Use the onrowsdelete event to receive a notification before rows are deleted.
For further details about data source objects, see the page for the recordset object.

How to register:

<ELEMENT onrowsinserted="handler">

In JavaScript:
object.onrowsinserted = handler;
object.attachEvent ("onrowsinserted", handler);
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript.

Basic information:

Bubbles Yes
Cancelable No
Event object -

Actions that invoke the onrowsinserted event:

  • Inserting rows into the data source object.

Example HTML code 1:

This example illustrates the use of the onrowsinserted event:
    <script type="text/javascript">
        function InsertRow () {
            var xml = document.getElementById ("movies");
            var xmlDoc = xml.XMLDocument;
            var moviesNode = xmlDoc.getElementsByTagName ("movies")[0];

            var movie = xmlDoc.createElement ("movie");
            AddChildToMovie (movie, xmlDoc, "name", "Fred Flinstone");
            AddChildToMovie (movie, xmlDoc, "jobtitle", "Caveman");
            AddChildToMovie (movie, xmlDoc, "born", "1970");

            moviesNode.appendChild (movie);

        function AddChildToMovie (movie, xmlDoc, tagName, value) {
            var child = xmlDoc.createElement (tagName);
            child.text = value;
            movie.appendChild (child);
        function OnRowsInserted () {
            alert ("Rows have been inserted in the data source!");
    <xml id="movies" onrowsinserted="OnRowsInserted ()">
    <?xml version="1.0"?>
                <name>Clark Kent</name>
                <name>Lois Lane</name>

    <table id="myTable" width="100%" cellpadding="0px" cellspacing="2px" border="1px" datasrc="#movies" datapagesize="3">
                <td><span datafld="name"></span></td>
                <td><span datafld="jobtitle"></span></td>
                <td><span datafld="born"></span></td>
    <br />
    <button onclick="InsertRow ();">Insert a new row into the data source!</button><br />
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content