Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: clipboard

  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    clipboard

    I have made a colour chart web page for some students to use to see:
    • Web safe 219 colours
    • X11 named colours
    • VGA 16 named colours
    • Web Smart (4096 colours)


    Each colour is represented by a div which has appropriate bg colour. I have titled each div with the name and HEX value of the colour. This is so when I hold the mouse over a div is tells us the colour values of the div. That great but It would be highly benificial if the students could click the div and the hex value/named value could be written to the clip board.

    Is there a script for sending text to the clipboard?
    You can not say you know how to do something, until you can teach it to someone else.

  • #2
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    There is a very nifty IE only script if you care for it? Most folks are always looking for something Xbrowser.
    Give an example of one of your DIV color tags and I'll whip it up for you.

  • #3
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Code:
    <div class="cols" style="background-color:#000033;" title="Hex: #000033" onclick="update('000,000,255','0000FF','blue');">&nbsp;</div>
    It is the middle parameter in the call to update function. The Hex value

    Thanks
    You can not say you know how to do something, until you can teach it to someone else.

  • #4
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD><TITLE>put something on the clipboard </TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <STYLE type=text/CSS>

    </STYLE>
    <SCRIPT type="text/javascript">
    function update(a,b,c){
    document.getElementById('CB').value=a;
    Copied = document.getElementById('CB').createTextRange();
    Copied.execCommand("Copy");
    }
    </SCRIPT>

    <META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
    <BODY>
    <input type=hidden ID="CB">
    <div class="cols" style="background-color:#000033;" title="Hex: #000033" onclick="update('000,000,255','0000FF','blue');">&nbsp;</div>

    <TEXTAREA>test it here</TEXTAREA>

    </BODY></HTML>






  • #5
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    thx
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

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