www.webdeveloper.com
Results 1 to 3 of 3

Thread: Copy html sorce code script?

  1. #1
    Join Date
    May 2006
    Posts
    13

    Copy html sorce code script?

    What i need:
    A button that copys the source code of the current page minus the button code.

    How i would like it done:
    If at all possible i would like this done with php. I would like the script to copy the html source code of the page minus the copy button code and print out a validation response "HTML source has been copied to the clip board"

    Can this be done? were should i start?

  2. #2
    Join Date
    Apr 2005
    Location
    Bathurst, NSW, Australia
    Posts
    3,357
    PHP is a server side language, and you want the code copied from the client side. You may be able to do this using JavaScript, eg var code = document.getElementsByTagName("html")[0].innerHTML;

    Then remove the "button" stuff and copy to the clipboard -- if thats possible in JavaScript...? you might even requite activeX (IE only).

    Or, simply give instructions. Open view > view source. Right click and select all. Right click and copy. TaDa!!

  3. #3
    Join Date
    May 2004
    Location
    FL
    Posts
    3,447
    The script here should help you accomplish what you are trying to do.
    Lee

    ""Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."" -- Sir Winston Churchill

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles