Thanks! It works like a charm!
/peter > On Sun, 15 Feb 2004 07:52:11 +0100 (CET), you wrote: > > Could be missing the point here because your question is quite vague. > > However... > >>I am using a web page that uses the following php code to display the >>contents of a dynamically update webpage: >> >><?php >>include("http://.../source.xls); >>?> >> >>Is it possible to "forward" the contents of the code to a javascript? >>eg if the file "source.xls" contains the text "help me" is it possible to >>send that text to a javascript? I am quite stuck here so any help would >> be >>greatly appreciated. > > source.xls just contains a bit of text, right? And you want that to end up > in a Javascript variable? > > First, I'd use file_get_contents() or file() to get the contents of > source.xls into a PHP array. > > $source = file_get_contents ('http://.../source.xls'); > > Next, you have to remember that Javascript is just text, the same as HTML. > So you can embed $source into a Javascript block in the same way as you > would embed it into HTML. > > <script language="Javascript"> > function doAlert () > { > var source = "<? echo ($source) ?>"; > alert (source); > } > </script> > > <a href='javascript:doAlert()'>Click Me</a> > > Apologies for any mistakes in the Javascript, but I'm sure you get the > idea. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php