Problem: All methods of FormData do not work/compatible with Internet Explorer. The only method that is successful is 'append'. but suppose you want to override values of specific keys but in that scenarios 'set' and 'delete' methods will not work on Internet Explorer.
Solution: You may use below code that will work on IE.
var form = $('form')[0];
var formData = new FormData();
var inputs = form.getElementsByTagName('input'); //for input box
var inputsList = Array.prototype.slice.call(inputs);
inputsList.forEach(
function (i) {
if (i.name !== 'excludedName') {
formData.append(i.name, i.value);
}
}
);
formData.append('excludedName', 'value you want to set');
Note: for 'select' and 'textarea' use:
var selects = form.getElementsByTagName('select');
var textareas = form.getElementsByTagName('textarea');
JavaScript :
We can disable or enable an input box by setting property true or false respectively by using below code.
Code of input box
Name: <input type="text" id="myName">
To Disable input box.
document.getElementById("myName").disabled = true;
To Enable input box.
document.getElementById("myName").disabled = false;
jQuery :
If you are using jQuery 1.6+ then you should use the .prop() function to disable or enable input field.
$("input").prop('disabled', true);
$("input").prop('disabled', false);
Above code will disable all the input fields, if you want to disable or enable particular field, then you should use class or id of that particular input field.
Name: <input type="text" id="myName" class="myName">
$("#myName").prop('disabled', true); // using id of input box
$(".myName").prop('disabled', false); // using class of input box
If you are using jQuery 1.5 or below then you should use the .attr() function.
To disable input field:
$("input").attr('disabled', 'disabled');
To enable input field:
$("input").removeAttr('disabled');
There is also .removeProp like .removeAttr in jQuery 1.6 but we should not use it because once you use removeProp you can not again disable it.
This JavaScript will Disable select, copy and paste of the content.
Put below given JavaScript in <script></script>
tag inside <head></head>
tag of your webpage.
If you want to use this script on your blog then go-to Layout > Add a Gadget > Use HTML/JavaScript Gadget and Paste below given code inside it.
JavaScript Code:
//Script open tag
//form tags to omit in NS6+:
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
//Script close tag
Sometimes web page owners want to protect data such as Text and Images to be copied by others and sometimes it is about the link on the page that must be operate on same page by clicking mouse left button because of these reasons web page owners put a JavaScript code in their web pages to disable mouse Right click.
So if you want to perform same task then just copy paste below code inside your web page's <head> tag.
<script type="text/JavaScript">
var message="Right-click has been Disabled";
function clickIE() {
if (document.all) {(message);return false;}}
function clickNS(e) {
if(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS;}
else{ document.onmouseup=clickNS;
document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</script>
When somebody will come to your web page and will click on page by mouse right button then a message will pop-up "Right Click has been Disabled".
In this tutorial we are working with Back Button same as History Back button of Internet Browsers(eg. Internet Explorer, Mozilla Firefox etc.)
To understand this phenomena take an example that if you have made a search on a page(index.jsp) and you have to moved on another page(some_other_page.jsp) but you want to see previous search again then you have to back through Internet Browser Back button but you can add similar back action by coding which i am try to explain by this example with code.
index.jsp
some_other_page.jsp
script inside <head> tag
back button code on same page inside <body> tag
Disclaimer
We shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its response or damage to your system. We do not guarantee that the integrity or security of this communication has been maintained or that this communication is free of viruses, interceptions or interferences. Anyone communicating with us by email accepts the risks involved and their consequences. We accept no liability for any damage caused by any virus transmitted by this site.