PDA

View Full Version : Sending data to div class - How?



Coolname007
07-21-2009, 12:39 AM
Hello all.
I am having trouble figuring out how to send data to a div class using Javascript. I have Googled all over the Web, but have still not found the solution to my problem.

Basically, the whole point of this exercise is so I can have a widget on the sidebar at my site (http://coolname007.webs.com/) which will display the latest forum posts, which can be found at this address (http://ets-forums.forumotion.com) (a different domain than the home site). I almost got it to work by basically copying over the code from the widget at the forums themselves (which already had such a widget), and then changing all the href addresses to be the full instead of only the directory (necessary since its a different domain). For example, I had to change a line like this


<a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/forum-games-f3/count-to-one-million-t4.htm#48">Count to one million!</a>

to


<a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="http://ets-forums.forumotion.com/forum-games-f3/count-to-one-million-t4.htm#48">Count to one million!</a>

instead. But unfortunately, the widget is not updating by itself on the home site when a new topic or post is made, and so consequently I'm looking for other solutions. :cool:

Hopefully the following code will give everyone a clue of what I need


<script type="text/javascript" src="http://ets-forums.forumotion.com/general-discussion-f1/">
{
function getElement() {
var new_posts = document.getElementById ("forummenu-options");
}
if (new_posts == document.getElementById ("comments_scroll_div")) return;
else
var send_data = new Array();
send_data[0] = new_posts;


</script>


Obviously, it needs more code in order to work. The general idea is that the element with Id "forummenu-options" (which is a div class that stores the links and other info of topics/posts posted in forum "general discussion) will get called by "document.getElementById" as I understand it, and the data that it contains will get transferred into the variable "new_posts". Assuming that code works, I would need some way to send only the topic names/links (along with their authors) to the div class I aforementioned.

Here is the code storing the widget on the forums themselves:


<div class="module borderwrap"><div class="maintitle"><h3>Latest topics</h3></div><div class="box-content"><div id="comments_scroll_div" style="height:200px;overflow:auto">&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/the-moderating-team-f38/ets-moderator-signature-pic-t13.htm#50">ETS moderator signature pic</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Today at 3:11 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/movies-f32/the-new-movie-2012-t12.htm#49">The new movie '2012'!</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Today at 1:44 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/forum-games-f3/count-to-one-million-t4.htm#48">Count to one million!</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Yesterday at 14:25 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/the-moderating-team-f38/assigning-moderators-t3.htm#44">Assigning Moderators</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Yesterday at 11:59 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=2"><span style="color:#000099"><strong>Dark Knight</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/the-rest-of-the-world-f18/copter-crash-kills-16-in-afghanistan-nato-says-t11.htm#40">Copter crash kills 16 in Afghanistan, NATO says</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Yesterday at 3:22 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/israel-f14/israel-rejects-us-call-to-halt-jerusalem-project-t10.htm#39">Israel rejects U.S. call to halt Jerusalem project</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Yesterday at 3:08 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/china-f13/china-says-police-killed-12-in-urumqi-rioting-t9.htm#38">China says police killed 12 in Urumqi rioting</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Sun 19 Jul 2009 - 15:22 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/israel-f14/israel-told-to-halt-east-jerusalem-housing-project-t8.htm#37">Israel told to halt east Jerusalem housing project</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Sun 19 Jul 2009 - 15:19 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br />&raquo; <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/the-water-cooler-f39/share-your-favorite-pics-t7.htm#36">Share your favorite pics!</a><br /><img src="http://illiweb.com/fa/empty.gif" alt="" />Sun 19 Jul 2009 - 1:43 by <a onmouseover="document.getElementById('comments_scroll_container').stop();" onmouseout="document.getElementById('comments_scroll_container').start();" href="/profile.forum?mode=viewprofile&amp;u=1"><span style="color:#000099"><strong>Coolname007</strong></span></a><br /><br /></div></div></div><script type="text/javascript">//<![CDATA[
div_marquee('comments_scroll_div', 'comments_scroll_container', 'up', '2', '90', '200', 'genmed');//]]></script>

Most of my trouble is due to not being able to figure out how in the hell data is even sent to the widget (the version on the forums) when a new topic/post is made in the forums.

If anyone wants to view the whole source code for the forums, all you got to do is go to this link:
http://ets-forums.forumotion.com/forum.htm
open up the "View" menu in your browser, and click "Page Source" (if you're using Firefox) in order to view and check out the whole code.

Thanks in advance for any help.

If you need any more details, just ask.