Posts

Showing posts with the label HTML

How to get multiple inputs to use key functions in Javascript/HTML?

How to get multiple input types to use the Enter key? This is my code. //keypress enter var input = document.getElementById("cost"); input.addEventListener("keyup", function(event) {   if (event.keyCode === 13) {     event.preventDefault();     document.getElementById("calc").click();   } }); As you can see, this code can only extract 1 element at a time. 2 answers: Answer 0: (Score: 3) Use to querySelectorAllselect all input type elements, and then apply a loop to assign event listeners to them: var inputs = document.querySelectorAll("input"); for (var i = 0; i < inputs.length; i++) {   inputs[i].addEventListener("keyup", function(event) {     if (event.keyCode === 13) {       event.preventDefault();       document.getElementById("calc").click();     }   }); } Answer 1: (Score: 2) You just need to use getElementsByClassName to select all input elements, and then app...

java program to read text from html file

import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.net.URLConnection; import java.io.*; import java.net.*; import javax.swing.text.*; import javax.swing.text.html.*; public class ReadTextFromHTML { public static void main(String[] args) throws Exception{  EditorKit kit = new HTMLEditorKit();         Document doc = kit.createDefaultDocument();         // The Document class does not yet handle charset's properly.         doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);         // Create a reader on the HTML content.         Reader rd = getReader("http://theprogrammersfirst.blogspot.com/2016/06/javalangexception-error-getting-all.html");         // Parse the HTML.         kit.read(rd, doc, 0);       ...

404 not found error redirect to a page

Image
                                          tomcat custom http status 404 Error page configuration If a requested page and it does not exist. tomcat default page look like this. Here i am requesting for a page images in my application. But it is not present. Tomcat default error 404 page showing this page. follow below step to override tomcat default 404 error page You can put a custom page. create a the page ' NotFound.html ' in your application home directory. Add the following in web.xml file. ( CATALINA_HOME/conf/web.xml)     <welcome-file-list>         <welcome-file>index.html</welcome-file>         <welcome-file>index.htm</welcome-file>         <welcome-file>index.jsp</welcome-file>     </welcome-file-list>

Background image Problem

Solution for background Image problems in  Apple Mail 9 Outlook 2000 Outlook 2002 Outlook 2003 Outlook 2007 Outlook 2010 Outlook 2011 Outlook 2013 Outlook 2016  Thunderbird 45 Android 4.4 Gmail App Gmail App iPhone 5 iPhone 5s iPhone 6 iPhone 6s  iPhone 6s Plus iPad (Retina) iPad Mini AOL Mail G Suite Gmail Office 365 Outlook.com Yahoo! Mail