Accessing to an element inside a div with javascript

Hi i have this html page and I need to access to the table "mytable" inside the "inicio" div with function in javascript I build this code but it doesn' t work.


function fncResult(){
      var aux = "<table><tr><td>Hi</tr></td></table>";
}
function fncPrint(){
      document.getElementsByTagName("table").elements["mytable"].innerHTML = fncResult();
}
<html>
      <head>
            <title></title>
      </head>
      <body onLoad="bodyInit()">
            <form name="theForm">
                  <table name="tabla" width="100%" border="0" cellpading="0" cellspacing="0">
                        <tr>
                              <td>
                                    <div id="inicio" next="">
                                          <table>
                                                <tr>
                                                      <td>
                                                            <tr>
                                                                  <td>
                                                                        Filtro a aplicar:
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        <input type="text" name="myfilter" style="width:150">
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        Columna para filtrar:
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        <select name="mycolumn" style="width:150"></select>
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        <input type="button" value="Buscar" onclick="fncPrint();">
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        <hr>
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>Introduzca la etiqueta manualmente:</td>
                                                            </tr>
                                                            <tr>      
                                                                  <td>
                                                                        <input type="text" name="txtEtiqueta" style="width:150">
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        <hr>
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td>
                                                                        <table name="mytable" border="1" cellspacing="0" cellpadding="0" bgcolor="white">
                                                                              <tr>
                                                                                    <td align="center" width="550" height="240">
                                                                                          <b><i>*** No hay filtro aplicado ***</i></b>
                                                                                    </td>
                                                                              </tr>
                                                                        </table>
                                                                  </td>
                                                            </tr>
                                                      </td>
                                                </tr>
                                          </table>
                                    </div>
                              </td>
                        </tr>
                  </table>
            </form>
      </body>
</html>
gnrl_greviousAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DanielSchafferCommented:
Personally, I'm a big fan of using the getElementById() function. Assign the ID property to your tag:

<div id="myDiv">Stuff!</div>

is accessed like:

document.getElementById('myDiv')

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.