SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: ActiveXObject problem
-
Oct 2, 2007, 06:13 #1
- Join Date
- Jun 2006
- Posts
- 177
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ActiveXObject problem
Code:<script type="text/javascript"> function get_file() { var fso; var file; var line; var counter = 0; fso = new ActiveXObject("Scripting.FileSystemObject"); file = fso.OpenTextFile("c:/xammp/xampp/htdocs/blue-wave/pbs.txt"); line = file.ReadLine(); while (line != "") { document.write('<input type="text" name="' + counter + '" id="' + counter + '" value="' + line + '" />'); counter++; line = file.ReadLine(); } } </script>
It is called from here:
PHP Code:<?php
include("database_transfer.js");
echo '<html>
<head>
<title>Database transfer</title>
</head>
<body>
<form name="frm" action="database_transfer.php" method="post">
<script type="text/javascript"> get_file(); </script>
</form>
</body>
</html>';
?>
-
Oct 2, 2007, 09:28 #2
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
ActiveX control
Shouldn't the script tags be inside the head tags, not before the html tag?
Are you getting any error message?Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Oct 3, 2007, 03:02 #3
- Join Date
- Jun 2006
- Posts
- 177
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Got it solved. Well... kinda. It works fine if I open it as a file in my browser. It refuses to work if I want to run it from my localhost, though.
-
Oct 3, 2007, 06:12 #4
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
security
If the script works when opening from the OS file system, but not from localhost, then it sounds like a security block.
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
Bookmarks