New to this New to this - 2 months ago 8
HTML Question

Adding JavaScript line into some code

I am trying to password protect some text in a Blogger blogpost and I found a website that explains how to do so.

I had to add this line of code between my

<head>
tags in the html template:

<script type="text/javascript" src="http://www.vincentcheung.ca/jsencryption/jsencryption.js"></script>


And once that's done I just need to:


  1. copy the text from the blogpost I want to password protect into their box here → http://www.vincentcheung.ca/jsencryption/

  2. Type my password in their Key box

  3. Copy the HTML code provided in their last box.



This is the basic code used in the body of the html code of my blogpost to do the decryption:

<div id="uniqueID" title="encrypted text">
<a href="javascript:decryptText('uniqueID')">Show encrypted text</a>
</div>


And I can easily change the text "Show encrypted text" by anything else I like.

However, once people click in the 'Show encrypted text' link, a box pops out, with some text:

enter image description here

And I would like to change that and do not know how to do so, since I don't know any JavaScript at all.

In the instructions, it says:

You can change the message in the dialog box that asks for the key by providing the desired message as a second parameter, eg. decryptText('uniqueID', 'Enter the password:')

But I don't really know where to add it. I have tried, but nothing seems to work.
Here is the website: http://www.vincentcheung.ca/jsencryption/instructions.html

Answer

You have this inserted in your page:

<a href="javascript:decryptText('uniqueID')">Show encrypted text</a>

Just add a second parameter to that function call with your custom question:

<a href="javascript:decryptText('uniqueID', 'Enter your passworld please.')">Show encrypted text</a>