HighDots Forums  

Passing variable from function to html body...

Javascript JavaScript language (comp.lang.javascript)


Discuss Passing variable from function to html body... in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
S. Cole
 
Posts: n/a

Default Passing variable from function to html body... - 10-31-2008 , 10:20 AM






Hi,

Can someone help me pass a variable from a function in a header to the
body of an html page.

Header Code:
function doLoad()
{
xml = new XMLHttpRequest();

xml.onreadystatechange = function()
{
var elem = null;
var rss_url = null;
var edgerssfeed = null;
var settings = null;
var rssData = null;

if( xml.readyState == 4 )
{
settings =
xml.responseXML.documentElement.getElementsByTagNa me( 'edgerssfeed' );

for( var c = 0; c < settings.length; c++ )
{
rss_url = settings[c].getElementsByTagName( 'url' )
[0].textContent;

elem = document.createElement( 'div' );
elem.innerText = rss_url;
document.getElementById("edge_rss_feed").appendChi ld( elem );
rssData = new Spry.Data.XMLDataSet(rss_url, "rss/channel/item");
}
}
}

xml.open( 'GET', 'settings.xml', true );
xml.send( null );
}



body code:
<div spry:region="rssData">
<table width="100%">
<tr spry:repeat="rssData">



I've left a few things out, but this is the basics of it..


Basically I need to pass the rssData variable from the function to the
SPRY:REPEAT (SPRY:REGION) code in the html body.

If I put the:
rssData = new Spry.Data.XMLDataSet(rss_url, "rss/channel/item");

by itself and not in a function (with rss_url = the actual url) it
works.

Many thanks,
Shannon


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.