|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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> |
<a href="#" title="Copy it" onClick="reset()" onmouseover="window.status='Copy password reset text'; return true;">
PW Reset</a> |
<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"> <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>
|
|
#2
|
|||
|
|||
|
*bump*
|
|
#3
|
|||
|
|||
|
bump*
|
|
#4
|
||||
|
||||
|
Is this for an intranet? Modern web browsers don't have access to the clipboard.
__________________
Stephen Free Computer Help, blog, forum Web design ebooks and software JavaScript scripts and tutorials |
|
#5
|
|||
|
|||
|
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> |
<a href="#" title="Copy it" onClick="reset()" onmouseover="window.status='Copy password reset text'; return true;">
PW Reset</a> |
<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"> <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>
return true;} //--> </script |
|
#6
|
|||
|
|||
|
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?
__________________
Stan Slaughter - http://www.StanSight.Com/ Sort Lock Table | Fixed Table Head | Easy Tab Navigation | Text Drop Shadows | Tool Tips | Broken Image Icon Replacement | Floating Table Titles |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
Quote:
__________________
Stan Slaughter - http://www.StanSight.Com/ Sort Lock Table | Fixed Table Head | Easy Tab Navigation | Text Drop Shadows | Tool Tips | Broken Image Icon Replacement | Floating Table Titles |
|
#9
|
|||
|
|||
|
Are you serious?? And where is that?
Last edited by puredemo; 04-19-2006 at 04:45 PM. |
|
#10
|
|||
|
|||
|
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
__________________
Stan Slaughter - http://www.StanSight.Com/ Sort Lock Table | Fixed Table Head | Easy Tab Navigation | Text Drop Shadows | Tool Tips | Broken Image Icon Replacement | Floating Table Titles |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|