SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    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>
    That's my javascript code. It worked ten minutes ago, and now it refuses to do the ActiveXObject line. It just stops there...

    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>'
    ;
    ?>
    Does anybody know what's wrong?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    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?

  3. #3
    SitePoint Zealot
    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.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •