SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict svcghost's Avatar
    Join Date
    Oct 2010
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript to change HTML before browser sees it

    Hey guys,

    I'm a bit new to DHTML and JavaScript DOM, so bear with me please. Okay so I want to grab a page from NBA.com that changes daily. I grab the HTML page and store it in a PHP variable. Is there anyway I can use JavaScript to alter every specific word in the grabbed HTML page "Bulls" to be "Your Team, the Bulls", before echoing it with PHP on my site?

    I know this is easy with PHP (using replace function), but is it possible to do with JavaScript too? I want it to change before the visitor sees it (before the browser displays it), that way it's like it's being loaded instantly the altered way.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,784
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    JavaScript would need to wait until the page had loaded before being able to make the change. To make the change before the page loads you'd need to do it with PHP.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict svcghost's Avatar
    Join Date
    Oct 2010
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there any way to have a client do preprocessing?


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
  •