faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

how to insert <hr> between two textboxes at runtime?

Apr 9th, 2008 20:19
ha mo, Dave Clark, tejaswini ingale,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tejaswini,

     How about this:

function InsertLineBefore(child)
{
    var ele = document.createElement("HR");
    child.parentNode.insertBefore(ele, child);
    return true;
}

     Here is some sample HTML for the above function:

<form action="">
  <fieldset>
    <input type="button" value="Insert"
     onclick="return InsertLineBefore(t2)">
    <p><input type="text" name="t1" size="20">
    <input type="text" name="t2" size="20"></p>
  </fieldset>
</form>

Take care,

Dave Clark
www.DaveClarkConsulting.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


http://www.businessian.com
http://www.healthinhealth.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com