#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Australia
    Posts
    52
    Rep Power
    12

    Unhappy Can JavaScript access file?


    Hi,

    Do anyone know how JavaScript to access the file? what I mean is, can JavaScript open and modify the data in the file (any kind, let says text file). If no, any alternative way to do this. Because I want to use JavaScript to access the HTML and CSS file to change the attribute value and content of web page. For example,
    using JavaScript to change the font size in HTML/CSS file and change color of background in HTML/CSS files. Can anyone help?
    thanks!

    Kind Regard,
    Jacky =)
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Midrand, South Africa
    Posts
    154
    Rep Power
    13
    Though you might be able to access a file, you might not be able to save it to the webserver. The reason for this is that even with sufficient rights, your browser lacks the capabilities to save it.

    You might consider using something like a Server Side Scripting language like PHP to do that.
    Neil Craig
    Software Developer
    SourceCode Techonolgy Holdings Inc
    South Africa
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Nov 2001
    Posts
    1,882
    Rep Power
    19
    Javascript can change document color properties, but you may want this:

    http://tech.irt.org/articles/js065/custom.htm
    ( http://tech.irt.org/articles/js065/#6 )

    This is javascript changing the CSS file that is linked to the document.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Australia
    Posts
    52
    Rep Power
    12

    Exclamation But...how to do this in PHP?


    Hi, thanks for your helps

    But ....can I do it by PHP? How?
    I've an idea, if I handle the style sheet change by JavaScript, then access JavaScript variable(is the style attribute & its value) by PHP (in fact, pass JavaScript variable to PHP), then using PHP to manipulate the file access and modification?
    can I? how?
    anybody can help? thank!

    Kind regard,
    Jacky =)

IMN logo majestic logo threadwatch logo seochat tools logo