whoisgregg

msg:4039677 | 9:20 pm on Dec 8, 2009 (gmt 0) |
Welcome to WebmasterWorld, richelectron! getElementsByClassName only takes one value. To chain them together, you'd use a construct like this: var tables = document.getElementById('iframecontent').getElementsByClassName('sortable'); |
|
|
richelectron

msg:4039994 | 10:02 am on Dec 9, 2009 (gmt 0) |
Thanks for the help whoisgregg :) When I use the construct that you supplied above, then I get a Error: document.getElementById("wikiframe") is null in the error console. I was thinking this might be because the iframe hadn't loaded when the JS was trying to execute and couldn't find it? I included the JS in the page that loads in the iframe and added a called to the sortables function right at the bottom of the page in the iframe, but no joy... Any ideas?
|
whoisgregg

msg:4040090 | 2:55 pm on Dec 9, 2009 (gmt 0) |
It could be that it hasn't loaded yet. If that's the case, make sure your javascript code is attached to the onload event of the page. This thread [webmasterworld.com] has some code that can help with that. Also, make sure your iframe has that "id" set and not just a "name" ;)
|
richelectron

msg:4040608 | 11:33 am on Dec 10, 2009 (gmt 0) |
Thanks for helping with this whoisgregg, I got this working. I wasn't actually doing this exactly as I had explained in my second post. I had inserted the call to the function in a part of the code that wasn't actually loading - so I inserted an alert as well and moved the code to a section of the page where I could see the alert. Basically I included the js function in the page that loads in the iframe and then called the function right at the bottom of the page that loads in the iframe - This allowed me to search for the sortable class by using the following construct: document.getElementsByClassName("sortable"); - much simpler and it works great! This has made my day :)
|
whoisgregg

msg:4040653 | 1:53 pm on Dec 10, 2009 (gmt 0) |
Glad you got it sorted! :)
|
richelectron

msg:4040656 | 2:04 pm on Dec 10, 2009 (gmt 0) |
Update: I had to implement this updated getElementsByClassName function <snipped URL> for cross browser compatibility. Thanks again. [edited by: whoisgregg at 5:41 pm (utc) on Dec. 10, 2009] [edit reason] Whoops, no URLs please. See TOS [webmasterworld.com] :) [/edit]
|
|