Create JS Array from Text File
Posted: Wed Dec 06, 2006 9:25 am
Burrito | Please use
Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello - a newbie--
I am at a loss as to why the following code will not work...
Commenting out the php results in the coded displays. uncommenting the the php results in a blank page only.....Help, Please.Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>aaaaaa</title>
</head>
<body>
<script type="text/javascript">
var jsarr= new Array();
<?php
$filename="linksfile.txt";
$lines = file("linksfile.txt");
foreach ($lines as $xxx) {
?>
jsarr[jsarr.length]='<?php echo $xxx?>';
<?php
}
?>
document.write("This is just a check")
document.write(jsarr[0])
</script>
</body>
</html>Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]