CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2006
    Posts
    15

    Question Problem with firefox

    Hello All,
    I have a table in the client side and when I try to insert a cell (in javascript) and add to the innerHTML of the cell a user control it works in Internet Explorer, but when I try to do the same in Firefox it does not work.
    the code:

    var betTable = document.getElementById('BetAskTable');
    var newRow = betTable.insertRow(location);

    var newCell = newRow.insertCell(-1);
    newCell.id = 'Ask' + optionID + 'OddsTD';
    newCell.innerHTML = ‘<Table><TR><TD>' + '<img src="Images/Transparent1px.gif">' + '</TD></TR></Table>';

    thanks

  2. #2
    Join Date
    Jul 2001
    Location
    Netherlands
    Posts
    751

    Re: Problem with firefox

    Firefox wants you to use the dom interface for adding elements, rather than using innerHTML:


    Code:
    <script language='javascript'>
    function test()
    {
    var location=-1;
    var optionID='hoyhoy' ;
    var betTable = document.getElementById('BetAskTable');
    var newRow = betTable.insertRow(location);
    
    var newCell = newRow.insertCell(-1);
    newCell.id = 'Ask' + optionID + 'OddsTD';
    var img=document.createElement('img') ;
    img.src="Images/Transparent1px.gif" ;
    newCell.appendChild(img) ;
    
    }
    </script>
    <body>
    <input type='button' value='test' onclick='test()'>
    <table id='BetAskTable' name='BetAskTable'></table>
    </body>

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured