www.webdeveloper.com
Results 1 to 2 of 2

Thread: clone.getElementsByTagName("td"[6]has no properties !!

  1. #1
    Join Date
    Oct 2008
    Posts
    28

    clone.getElementsByTagName("td"[6]has no properties !!

    hello,

    I always received a message "clone.getElementsByTagName("td")[6] has no properties message !!! how to I avoid this problem ?

    Also, I would like to have 1 more row added in "Clock Information section" AND 1 more row added in "Clock's False Path Information" when the button "insert another clock" is pushed...

    Can you please help... ?
    Thank you very much in advance

    The below is my code:
    --------------------------------------

    <html>

    <head>
    <title> RC/DC Synthesis Constraint generator Page</title>

    <script type="text/javascript">

    var clone;
    function cloneDiv_c(){
    var divs=document.getElementById('clkDiv').getElementsByTagName('div');
    clone=divs[divs.length-1].cloneNode(true);
    }

    function cloneDiv_fp(){
    var divs=document.getElementById('fpDiv').getElementsByTagName('div');
    clone=divs[divs.length-1].cloneNode(true);
    }

    function removeDiv_c(){
    var root=document.getElementById('clkDiv');
    var divs=root.getElementsByTagName('div');
    root.removeChild(divs[divs.length-1]);
    }

    function removeDiv_fp(){
    var root=document.getElementById('clkDiv');
    var divs=root.getElementsByTagName('div');
    root.removeChild(divs[divs.length-1]);
    }

    function addDiv_c(){
    var root=document.getElementById('clkDiv');
    var divs=root.getElementsByTagName('div');
    var nr=root.getElementsByTagName('table').length+1;
    clone.getElementsByTagName('td')[6].firstChild.nodeValue=nr;
    root.appendChild(clone);
    clone=divs[divs.length-1].cloneNode(true);
    }

    function addDiv_fp(){
    var root=document.getElementById('fpDiv');
    var divs=root.getElementsByTagName('div');
    var nr=root.getElementsByTagName('table').length+1;
    clone.getElementsByTagName('td')[3].firstChild.nodeValue=nr;
    root.appendChild(clone);
    clone=divs[divs.length-1].cloneNode(true);
    }

    function addDiv_clock(){
    addDiv_c();
    addDiv_fp();
    }

    function removeDiv_clock(){
    removeDiv_c();
    removeDiv_fp();
    }

    function cloneDiv_all () {
    cloneDiv_c ();
    cloneDiv_fp ();
    }

    onload= cloneDiv_all;

    </script>
    </head>

    <body>

    <H1> <center> RC/DC Synthesis Constraint Generator </center> </H1>
    <P>

    <DL>
    <b> <font size = "4" > Clock Information </font> </b>
    </DL>
    <FORM id="form_clock" action="" method="post" >
    <div id="clkDiv">

    <div>
    <table border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td><p align="left">Clock Name &nbsp <input type=text name=clk value="pll_clk" size=15></td>
    <td><p align="left">&nbsp Clock Pin/Port Name &nbsp <input type=text name=pin value="pll_top_u/PLLOUT" size="29"></td>
    <td><p align="left">&nbsp Clock Period &nbsp <input type=text name=period value="25" size="5"></td>
    <td><p align="left">&nbsp Rise &nbsp <input type="text" name="rise" value="0" size="5"></td>
    <td><p align="left">&nbsp Fall &nbsp <input type="text" name="fall" value="0" size="5"> </td>
    <td><p align="left">&nbsp Generated clock &nbsp <select name="selected">
    <option value="no" selected="selected">no</option>
    <option value="yes" >yes</option>
    </select> </td>
    </tr>
    </table>
    </div>

    <div>
    <table border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td><p align="left">Clock Name &nbsp <input type=text name=clk value="scan_clk" size=15></td>
    <td><p align="left">&nbsp Clock Pin/Port Name &nbsp <input type=text name=pin value="phy_clksie_i" size="29"></td>
    <td><p align="left">&nbsp Clock Period &nbsp <input type=text name=period value="1000" size="5"></td>
    <td><p align="left">&nbsp Rise &nbsp <input type="text" name="rise" value="0" size="5"></td>
    <td><p align="left">&nbsp Fall &nbsp <input type="text" name="fall" value="50" size="5"> </td>
    <td><p align="left">&nbsp Generated clock &nbsp <select name="selected">
    <option value="no" selected="selected">no</option>
    <option value="yes" >yes</option>
    </select> </td>
    </tr>
    </table>
    </div>

    <div>
    <table border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td><p align="left">Clock Name &nbsp <input type=text name=clk size=15></td>
    <td><p align="left">&nbsp Clock Pin/Port Name &nbsp <input type=text name=pin size="29"></td>
    <td><p align="left">&nbsp Clock Period &nbsp <input type=text name=period size="5"></td>
    <td><p align="left">&nbsp Rise &nbsp <input type="text" name="rise" size="5"></td>
    <td><p align="left">&nbsp Fall &nbsp <input type="text" name="fall" size="5"> </td>
    <td><p align="left">&nbsp Generated clock &nbsp <select name="selected">
    <option value="no" selected="selected">no</option>
    <option value="yes" >yes</option>
    </select> </td>
    </tr>
    </table>
    </div>

    </div>

    <p align="left"><input name="button" type="button" value="Insert another clock" onclick="addDiv_clock()">
    <input name="button" type="button" value="Remove last clock entry" onclick="removeDiv_clock()">

    <DL>
    <b> <font size = "4" > Clock's False Path Information </font> </b>
    </DL>

    <div id="fpDiv">

    <div>
    <table border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td><p align="left">set_false_path -from &nbsp <input type="text" name=clk value="pll_clk" size="15"> </td>
    <td><p align="left">&nbsp -to &nbsp <input type="text" name=clk value="scan_clk" size="15"> </td>
    <td><p align="left">&nbsp &nbsp &nbsp &nbsp &nbsp Confirmation &nbsp <select name="selected">
    <option value="no" selected="selected">no</option>
    <option value="yes" >yes</option>
    </select> </td>
    </tr>
    </table>
    </div>

    <div>
    <table border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td><p align="left">set_false_path -from &nbsp <input type="text" name=clk value="scan_clk" size="15"> </td>
    <td><p align="left">&nbsp -to &nbsp <input type="text" name=clk value="pll_clk" size="15"> </td>
    <td><p align="left">&nbsp &nbsp &nbsp &nbsp &nbsp Confirmation &nbsp <select name="selected">
    <option value="no" selected="selected">no</option>
    <option value="yes" >yes</option>
    </select> </td>
    </tr>
    </table>
    </div>

    </div>

    </FORM>

    </bod>

    </html>

  2. #2
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    the function cloneDiv_c, as well cloneDiv_fp, are overwriting the variable clone. so, when you call addDiv_c, the clone doesn't contain six cell (td), it actually contain the three cell from clock's false path information. you need two different variable to retain each clone. also, you know there is six cell on each clock information but getElementsByTagName return an HTMLCollection that is similar to array. that is, the collection contain an index. so, the sixth index mean the cell number seven, which doesn't exist. same happen with third index you refer in addDiv_fp. those are the reason why you are getting such error.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles