aha2095 Posted June 26, 2010 Share Posted June 26, 2010 I'm extremely bad with javascript so I need help getting information from a HTML table that is in an iframe and turning it into a variable. The frame is opened with JS if that could affect it. Thankies for taking the time to read this post! Quote Link to comment Share on other sites More sharing options...
LordDan Posted June 26, 2010 Share Posted June 26, 2010 Hmmmm, if i remember correctly you can get the contents of a Frame/iFrame with window.frames.. I am going to assume the iframe has an ID of "myIframe", in the iFrame is a form with an id of "myForm" and a hidden input with the id "myInput".. I cannot guarantee this will work, but try this.. var myValue = window.frames['myIframe'].document.forms['myForm'].elements['myInput'].value And of course you should be able to set a value within an iFrame too. window.frames['myIframe'].document.forms['myForm'].elements['myInput'].value = "Boobies"; Give that a try. :thumbup: Quote Link to comment Share on other sites More sharing options...
aha2095 Posted June 27, 2010 Author Share Posted June 27, 2010 Ok, I'm confused now I thought it was in an iframe as it's the way it was always done but its just the pages being loaded with javascript on click I think (I did say I'm bad with JS right?). So I just need to get information from a HTML table and turn it into a variable. Quote Link to comment Share on other sites More sharing options...
LordDan Posted June 27, 2010 Share Posted June 27, 2010 Okay, well the table's <td> will need ID's if you want to get the value from it. <table><tr><td id="td1">Meh Value!</td></tr></table> Using the ID, you can get the value as such; <script type="text/javascript"> // Get the value var val = document.getElementById('td1').innerHTML; // Meh Value! // Change the value document.getElementById('td1').innerHTML = 'Meh new value!'; </script> Quote Link to comment Share on other sites More sharing options...
aha2095 Posted June 27, 2010 Author Share Posted June 27, 2010 Theres no id, but is there a battleship kind of system so it can get row and then the cell value? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.