www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 04-17-2006, 04:28 PM
    puredemo puredemo is offline
    Registered User
     
    Join Date: Apr 2006
    Posts: 15
    Cool Trying to get my clipboard to work

    Hey all,

    Is there a way to get the username checkbox in the code below to process the values from the top fields when create / copy is hit?

    my setvalues function is definitly not working correctly right now

    Code:
    <HTML>
    <HEAD>
    <style>
    BODY {
    	MARGIN-TOP: 20px; FONT-SIZE: 11px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
    }
    </style>
    <title>Copy to clipboard example</title>
    <script type="text/javascript">
    
    function enable() {
    var clip = form.fn.value + " called in: ID \""+ form.sn.value + "\" needs unlocked for " + form.tl.value + ". I enabled " + form.fn.value + "'s " + form.tl.value + " ID and verified login.";
    window.clipboardData.setData('Text',clip);
    }
    
    function reset() {
    var clip = form.fn.value + " called in: ID \""+ form.sn.value + "\" needs a password reset for " + form.tl.value + " login. I verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and confirmed login.";
    window.clipboardData.setData('Text',clip);
    }
    
    function setT(n){
    	document.getElementById("cons").value=n
    }
    
    
    function cnotes(){
    var objects = document.getElementsByTagName("input");
    var t="";
    
    for(var i=0;i<objects.length;i++)
    {
        if(objects[i].checked) t+=(objects[i].value+"\n\n");
    }
    
    
    setT(t);
    document.getElementById("cons").createTextRange().execCommand("copy");
    }
    
    
    function setvalues("cons")
    {
    if (C1.checked)
      {
    "test1" + form.fn.value;
      }
    elseif (C2.checked)
      {
    "test2";
      }
    elseif (C3.checked)
      {
    "test3";
      }
    else (C4.checked)
      {
    "test4";
      }
    }
    
    
    </script>
    </head><body>
    
    
    
    
    <form name="form">
    Admin clipboard<p>
    Name:<br>
    <input type="text" name="fn" size="16"><br>
    ID:<br>
    <input type="text" name="sn" size="16"><br>
    Tool:<br>
    <input type="text" name="tl" size="16">
    </form>
    <a href="#" title="Copy it" onClick="enable()" onmouseover="window.status='Copy ID unlock text'; return true;">
    ID Unlock</a>&nbsp;|
    <a href="#" title="Copy it" onClick="reset()" onmouseover="window.status='Copy password reset text'; return true;">
    PW Reset</a>&nbsp;|
    <a onclick="form.reset(); clipboardData.clearData(); return false;" href="#" onmouseover="window.status='Clear all forms and clipboard'; return true;">
    Clear All
    </a>
    </form>
    
    <p>
    
    
    <FORM name="checks">
    <TABLE>
      <TBODY>
      <TR>
        <TD><INPUT type=checkbox CHECKED name=C1 onclick="setvalues(this);"> Test </TD></TR>
      <TR>
        <TD><INPUT type=checkbox name=C2 onclick="setvalues(this);"> Why </TD>
        <TD><INPUT type=checkbox name=C3 onclick="setvalues(this);"> Wontyou </TD>
        <TD><INPUT type=checkbox name=C4 onclick="setvalues(this);"> work </TD></TR>
    </TBODY></TABLE>
    <P><TEXTAREA class=submit name=cons id=cons rows=20 cols=60></TEXTAREA></P><INPUT class=submit onclick=cnotes() type=button value="Create / Copy">&nbsp;&nbsp;&nbsp;<INPUT class=submit type=reset value=Reset name=B2> 
    
    <P><INPUT class=submit onclick="parent.location='mailto:linehad'" type=button value=Feedback> 
    </FORM></P>
    
    
    
    
    </body>
    </html>
    Reply With Quote
      #2  
    Old 04-18-2006, 10:01 AM
    puredemo puredemo is offline
    Registered User
     
    Join Date: Apr 2006
    Posts: 15
    *bump*
    Reply With Quote
      #3  
    Old 04-18-2006, 11:41 AM
    puredemo puredemo is offline
    Registered User
     
    Join Date: Apr 2006
    Posts: 15
    bump*
    Reply With Quote
      #4  
    Old 04-18-2006, 05:46 PM
    felgall's Avatar
    felgall felgall is offline
    Computer Consultant
     
    Join Date: Mar 2005
    Location: Sydney, Australia
    Posts: 7,979
    Is this for an intranet? Modern web browsers don't have access to the clipboard.
    Reply With Quote
      #5  
    Old 04-19-2006, 02:04 PM
    puredemo puredemo is offline
    Registered User
     
    Join Date: Apr 2006
    Posts: 15
    Not resolved.

    Yes, it's for IE.
    My setvalues function is still definitly not working right.


    Code:
    <HTML>
    <HEAD>
    <style>
    BODY {
    	MARGIN-TOP: 20px; FONT-SIZE: 11px; MARGIN-LEFT: 15px; COLOR: #333333; LINE-HEIGHT: 1.5; MARGIN-RIGHT: 15px; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: verdana, arial, helvetica, sans-serif; BACKGROUND-COLOR: #ffffff
    }
    </style>
    <title>Copy to clipboard example</title>
    <script type="text/javascript">
    
    function enable() {
    var clip = form.fn.value + " called in: ID \""+ form.sn.value + "\" needs unlocked for " + form.tl.value + ". I enabled " + form.fn.value + "'s " + form.tl.value + " ID and verified login.";
    window.clipboardData.setData('Text',clip);
    }
    
    function reset() {
    var clip = form.fn.value + " called in: ID \""+ form.sn.value + "\" needs a password reset for " + form.tl.value + " login. I verified ID validation criteria, reset " + form.fn.value + "'s " + form.tl.value + " password and confirmed login.";
    window.clipboardData.setData('Text',clip);
    }
    
    function setT(n){
    	document.getElementById("cons").value=n
    }
    
    
    function cnotes(){
    var objects = document.getElementsByTagName("input");
    var t="";
    
    for(var i=0;i<objects.length;i++)
    {
        if(objects[i].checked) t+=(objects[i].value+"\n\n");
    }
    
    
    setT(t);
    document.getElementById("cons").createTextRange().execCommand("copy");
    }
    
    
    function setvalues("t")
    {
    if (C1.checked)
      {
    "test1" + form.fn.value;
      }
    elseif (C2.checked)
      {
    "test2";
      }
    elseif (C3.checked)
      {
    "test3";
      }
    else (C4.checked)
      {
    "test4";
      }
    }
    
    
    </script>
    </head><body>
    
    
    
    
    <form name="form">
    Admin clipboard<p>
    Name:<br>
    <input type="text" name="fn" size="16"><br>
    ID:<br>
    <input type="text" name="sn" size="16"><br>
    Tool:<br>
    <input type="text" name="tl" size="16">
    </form>
    <a href="#" title="Copy it" onClick="enable()" onmouseover="window.status='Copy ID unlock text'; return true;">
    ID Unlock</a>&nbsp;|
    <a href="#" title="Copy it" onClick="reset()" onmouseover="window.status='Copy password reset text'; return true;">
    PW Reset</a>&nbsp;|
    <a onclick="form.reset(); clipboardData.clearData(); return false;" href="#" onmouseover="window.status='Clear all forms and clipboard'; return true;">
    Clear All
    </a>
    </form>
    
    <p>
    
    
    <FORM name="checks">
    <TABLE>
      <TBODY>
      <TR>
        <TD><INPUT type=checkbox CHECKED name=C1 onclick="setvalues(this);"> Test </TD></TR>
      <TR>
        <TD><INPUT type=checkbox name=C2 onclick="setvalues(this);"> Why </TD>
        <TD><INPUT type=checkbox name=C3 onclick="setvalues(this);"> Wontyou </TD>
        <TD><INPUT type=checkbox name=C4 onclick="setvalues(this);"> work </TD></TR>
    </TBODY></TABLE>
    <P><TEXTAREA class=submit name=cons id=cons rows=20 cols=60></TEXTAREA></P><INPUT class=submit onclick=cnotes() type=button value="Create / Copy">&nbsp;&nbsp;&nbsp;<INPUT class=submit type=reset value=Reset name=B2> 
    
    <P><INPUT class=submit onclick="parent.location='mailto:linehad'" type=button value=Feedback> 
    </FORM></P>
    
    
    
    
    </body>
    </html>
    selected = true;
    return true;}
    //-->
    </script
    Reply With Quote
      #6  
    Old 04-19-2006, 02:37 PM
    slaughters slaughters is offline
    Doo Wah Diddy
     
    Join Date: Apr 2006
    Location: Houston
    Posts: 1,275
    I'm looking at the DOM Reference section of my "Dynamic HTML, The Definitive Refernce" - O'Reilly book.

    I can't find any reference to the "clipboardData" method for the window object.

    Could that be a JScript method and not JavaScript one?
    Reply With Quote
      #7  
    Old 04-19-2006, 02:57 PM
    puredemo puredemo is offline
    Registered User
     
    Join Date: Apr 2006
    Posts: 15
    Yes, it definitly is jscript supported only. Should I post in a seperate forum?

    Any idea on this function? I am sure the setvalues function has some simple mistakes in it. I am good with concepts but bad bad bad with syntax.

    I realized that I needed it to reference the setT function but I'm not sure of how.

    Thanks,
    Dan
    Reply With Quote
      #8  
    Old 04-19-2006, 03:17 PM
    slaughters slaughters is offline
    Doo Wah Diddy
     
    Join Date: Apr 2006
    Location: Houston
    Posts: 1,275
    Quote:
    Originally Posted by puredemo
    ...Should I post in a seperate forum?...
    You might have better luck getting a quicker response in a JScript specific forum
    Reply With Quote
      #9  
    Old 04-19-2006, 04:43 PM
    puredemo puredemo is offline
    Registered User
     
    Join Date: Apr 2006
    Posts: 15
    Are you serious?? And where is that?

    Last edited by puredemo; 04-19-2006 at 04:45 PM.
    Reply With Quote
      #10  
    Old 04-19-2006, 05:23 PM
    slaughters slaughters is offline
    Doo Wah Diddy
     
    Join Date: Apr 2006
    Location: Houston
    Posts: 1,275
    A Google search turned up a few.

    Here looks like a pretty heavily used one:

    Client Side Web Development - http://forums.asp.net/130/ShowForum.aspx
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 09:55 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.