GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Mar-2004, 10:13
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about

[Help] JavaScript Encryption Script


I am trying to modify Walt's script that he posted in reply to my encryption method.

I want to allow the user to Copy the text to the clipboard, or manually select and copy it.

The problem I am having right now is with the copy button code.
I am trying to insert it, but it isn't quite working out for me.

I am trying to display it in this part of my email.js file:
Code:
Encrypt(value); numArray++; document.write ("<table border='0' cellpadding='3' width='80%' align='center'>"); document.write (" <form action='email_encryption.php' method='get' name='emailencrypt'>"); document.write (" <tr><td valign='bottom'>"); document.write (" <input type='submit' class='input' name='submit' value='Submit' />"); document.write (" <script src='copy.js'><\/script>"); document.write (" </td>"); document.write (" <td>"); document.write (" <i>Enter info to encode</i> <br />"); document.write (" <input type='text' class='input' name='encode' size='55' value='"); document.write (valueDisplay); document.write ("' />&nbsp;&nbsp;"); document.write (" <input type='text' class='input' name='numarray' size='3' value='"); document.write (numArray); document.write ("' />"); document.write (" </td>"); document.write (" </tr>"); document.write (" </form>"); document.write (" <tr><td></td>"); document.write (" <td valign='bottom'>"); document.write (" <form name='encryptedemail'>"); document.write (" <textarea class='input' name='encrypted' rows='" + outLines + "' cols='64'>"); document.write (javEncrypted); document.write ("</textarea>"); document.write (" </form>"); document.write (" </td>"); document.write (" </tr>"); document.write ("</table>");

You can see the latest versions of this at:
mrbobdouglas[dot]com/testing/email.js
mrbobdouglas[dot]com/testing/email_encryption.php
mrbobdouglas[dot]com/testing/copy.js

I include the external email.js file, and call the function to display the text boxes ect by:
Code:
<script> <!-- ProcessEncryption(); // --> </script>


Not sure where to go from here. :eek2

Thanks!
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #2  
Old 02-Mar-2004, 12:40
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by BobbyDouglas
I want to allow the user to Copy the text to the clipboard, or manually select and copy it.
Since by default my code already allows manual select and copy, that obviously does not need to be added.

As for a button to accomplish this task, I haven't a clue.
  #3  
Old 02-Mar-2004, 13:43
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
Quote:
Originally Posted by WaltP
Since by default my code already allows manual select and copy, that obviously does not need to be added.

As for a button to accomplish this task, I haven't a clue.
- The easier it is, the better it is

Yes someone can manually click inside the box and scroll down, then right-click and copy it. Or they can click one button.
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #4  
Old 02-Mar-2004, 15:36
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by BobbyDouglas
- The easier it is, the better it is

Yes someone can manually click inside the box and scroll down, then right-click and copy it. Or they can click one button.
I'm a keyboard user -- Ctrl-A Ctrl-C and done. No scroll, no right-click. But that's just me.

If I find anything about the button, I'll let you know.
  #5  
Old 02-Mar-2004, 16:39
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
I also use that, but others might not.

If you take a look again at http://www.mrbobdouglas.com/testing/...encryption.php you will see a few more set of errors.

I get a different error message this time though. Complaining about
1st one:
Line: 32
Char: 55
Error: Unterminated string constant
Code: 0

2nd one:
Line: 31
Char: 3
Error: Object expected
Code: 0
__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #6  
Old 02-Mar-2004, 16:53
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by BobbyDouglas
I also use that, but others might not.
Their loss

Quote:
Originally Posted by BobbyDouglas
If you take a look again at http://www.mrbobdouglas.com/testing/...encryption.php you will see a few more set of errors.
All I see is a gray background with the instructions. I've added the page source below. I'm using NS7 as my browser. The javascript console gave 2 errors:
Code:
Error: unterminated string literal Source File: http://www.mrbobdouglas.com/testing/email.js Line: 31, Column: 34 Source Code: str = str.substr(0,i) + """ + str.substr(i+1); ---------------------------------------------- Error: ProcessEncryption is not defined Source File: http://www.mrbobdouglas.com/testing/...encryption.php Line: 35
Obviously """ is not a double quote character. Try """" or "\""

Hope that's a help.

Code:
<html> <head> <style> td{font-family:Tahoma;font-size:11px;color:#ffffff} </style> <link rel = STYLESHEET href =" ../scripts/main.css" Type =" text/css" > <script src="email.js" type="text/javascript"></script> <script language="JavaScript"> <!-- function highlightmetasearch() { document.emailencrypt.encrypted.select(); document.emailencrypt.encrypted.focus(); } function copymetasearch() { highlightmetasearch(); textRange = document.emailencrypt.encrypted.createTextRange(); textRange.execCommand("RemoveFormat"); textRange.execCommand("Copy"); alert("This post has been copied to your clipboard."); } // --> </SCRIPT> </head> <body> Please follow the following instructions for this method: <br> <script> <!-- ProcessEncryption(); // --> </script> <p>Copy the generated info below and place it in the source code to display the text entered in the first box. Each encrypted piece placed on the same webpage should have a different array encryption name as shown by the var byX = new Array line where X is a numerical value. The numbered box above shows the next array to be created. The value may be modified if needed.</p> </body> </html>
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
We're looking for JavaScript codes / mini tutorials. JdS Web Design Forum 8 23-Nov-2008 04:27
JavaScript Resolution Redirection Tutorial pcxgamer Web Design Forum 0 01-Dec-2003 12:37
JavaScript Tutorial Part 1 pcxgamer Web Design Forum 2 01-Dec-2003 10:16
Why does javascript cause sound problem to website rhino1616 Web Design Forum 8 06-May-2003 17:25
VALIDATING file types on an PHP upload script? JdS MySQL / PHP Forum 0 02-Jan-2003 08:58

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:10.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.