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:
copy the text from the blogpost I want to password protect into their box here → http://www.vincentcheung.ca/jsencryption/
Type my password in their Key box
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">
Show encrypted text
</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:
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
You have this inserted in your page:
Show encrypted text
Just add a second parameter to that function call with your custom question:
Show encrypted text
Related
I'm trying to fill in a form by pasting javascript into the debug console but although the data shows up on screen, the form still gives errors about being empty.
Is there a way to update an online form with javascript per element? I've seen people do it with a submit:
document.getElementById("firstName").value="Username";
document.forms[0].submit()
But I need the page to update after certain items because it will offer different fields in response. Also, I don't think there is an HTML form in the code because I get this response:
console.log(document.getElementById("firstName").form.id)
<empty string>
Could I do something (functionally) like this:
document.getElementById('firstName').value = 'myname';
document.getElementById('firstName').submit();
(I know this is not valid code, but I no idea how else to explain myself:( )
One of the problems is that just setting the name makes it show up on screen, but when I press the pay button on the page it simply says the name is still not filled in. I then have to click the name field, type a space, press return, and then the name is finally 'seen', but with an extra space.
if the firstName input is just a child element of the form, you can try
console.log(document.getElementById("firstName").parentNode.id);
document.getElementById('firstName').value = 'myname';
document.getElementById('firstName').parentNode.submit();
Is it possible to achieve formatting of text in JS alert message?
<script>
function myFunction() {
alert("1.Enter your name. 2. Enter your mobile no. 3.Do not press back
button.");
}
</script>
I want these 3 messages to appear one below the other. I tried:
<p>1.Enter your name.</p><p> 2. Enter your mobile no.</p><p> 3.Do not
press back button.</p>
Didn't work. Also, wish to add this img src tag after the last message:
<img src="http://forums.nextgames.com/resources/emoji/smiley.png" alt="smily"/>
Thank you.
The alert box is a object, and not related to CSS. To do this style of thing you would need to create an HTML element and mimic the alert() functionality. The jQuery UI Modal box does a lot of the work for you.
try adding "/n" before the lines example "\n2", "\n3"
The browser alert box does not support rendering HTML, however you can use plain-text formatting like \n newline and \t tab.
alert("1.Enter your name.\n2. Enter your mobile no.\n3.Do not press back button.");
I have one Text Box (also called "Text Entry") in my qualtrics survey in which I want participants to write something but I do not want to have the result saved in my data. I do not want to use the password function, therefore I have used JavaScript at the Text Box level.
The code below works to the extent that whatever participants put in the Text Box it will be set to an empty string the moment they hit the Next-Button.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place Your Javascript Below This Line*/
var currentQuestionID = this.getQuestionInfo().QuestionID
var input = $("QR~"+currentQuestionID);
$('NextButton').onclick = function (event) {
input.value = ""
}
});
The problem: This code only works sometimes. For example when I have two textboxes with the exact same code it only works for the first but not the second one. Similarly for some reason if the textbox is embedded in some other questions it doesn't work either.
Does anybody know how I can make this work either by changing my code or with a completely different solution? Essentially, I just want participants to entry some text which will never be saved in my data and I cannot use the password function.
Solution: One way of solving this would be adding a "Descriptive Text" item in which you can add some simple HTML code:
<p>Please provide your email address:</p><p><br></p>
<input name="nothing" type="textarea">
I don't think JavaScript works well in this case as it can't be guaranteed to run before the page has sent the data.
The best way is to make a dummy HTML "question" which has the appearance of a form but does not save any information.
I tried this out in a test survey by adding a question of type "Descriptive Text", and then in "HTML View" for that question, adding:
<p>This is not a real question, there is just a HTML textarea. </p>
<form id="mydummyform">
<input name="nothing" type="textarea" />
</form>
I found that this sometimes showed the HTML source instead of the form in the survey editor; if it does this, just go to "HTML View" and then "Normal View" and it should resolve correctly. This problem was only in the editor -- it always showed correctly in a preview of the survey.
i have this script for summarizing text and want to take the input from html text fields to input it to the script and them show the results on the page.
i currently have
title = raw_input('Type a title for the text here:')
content = raw_input('Type the text to be summarized here:')
how can i change this to get the input from the html form?
Title:< input type = "text>
Content:< input type = "text>
I am not sure what do you mean when you say you want it as an offline webpage. You will need to use a server to handle that. This article here: http://docs.python.org/2/howto/webservers.html explains such a system. Once you are ready to put this on a server, you may take a look at http://learnpythonthehardway.org/book/ex51.html on how to handle web-forms with python.
I am using the tinymce editor to give a good look of textarea where user write some comments. I want to give him two options: one is plain text and the other is a rich text editor option. When the user clicks on plain text option all rich text option removed and when user click on rich text it will get all options of formatting text. I want to do this in TinyMce Editor.
Is there anyone know how to implement it? I am searching from last 6 days how to implement this but i am failed to get any solution.
This is what i did for my site;
<script type="text/javascript">
function changeposttype(){
if($("#posttype option:selected").text() == 'Simple'){
//tinymce.execCommand('mceToggleEditor',true,'new-post-desc');
tinyMCE.execCommand('mceRemoveControl', false, 'new-post-desc');
}else{
tinyMCE.execCommand('mceAddControl', false, 'new-post-desc');
}
}
</script>
And inside BODY tag
<select id="posttype" onchange="changeposttype()">
<option>Rich</option>
<option>Simple</option>
</select>
<br />
<textarea id="new-post-desc" class="PostEditor"></textarea>
Well, you can take a look here:
Toggle editor with JavaScript
The code used is:
toggleEditor('content')
If you want the editor mode to be toggled based on the option chose by the user from another page, you can execute (or not to) the above function on page load.
There are links to other examples on that page which you might find useful too.
Update:
Upon reading the question a second time, you are asking for a plain-text/html and not a html-source/wysiwyg model. My suggestion above isn't the exact solution but it is still workable if the mode switching in the plain-text mode is hidden and locked.