We’ve added a new feature to HTMLGoodies that enables you, the reader, to actually test your HTML live on our site. Where applicable, we’ll add a “test the code” form on a tutorial page. If you’d like to test out the HTML, CSS or JavaScript that is being discussed, simply copy and paste it into the form, and press the “view” button. A new window or tab (depending on how you have your browser configured) will open, showing the results of the code you just entered.
How Does It Work?
This is what the Test Your HTML box will look like, except that we have already entered some code, in this case, a bit of JavaScript that writes out your IP address when the window is opened, and a couple lines of CSS that make use of the Google Font API.
And here’s how it will normally appear on the page:
Advertisement
Test Out Your Code
Can I See the Code That Does the Work?
The JavaScript behind this little tool is fairly simple. It just takes the text that you enter into the form field, and writes it to the new document that is opened. Your web browser does the rest. Here’s the actual JavaScript function:
function displayHTML(form) {
varinf = form.htmlArea.value;
win = window.open(“, “, ‘popup’, ‘toolbar = no, status = no’);
win.document.write(“” + inf + “”);
}
Note that since your web browser actually interprets the HTML code you have entered, the way it will behave will depend on the features that are supported by your browser. Have fun!
In business applications, dashboards provide at-a-glance views of Key Performance Indicators (KPIs) relevant to a particular objective or process. As business services have moved to the Cloud, so too have dashboards. Web-based dashboards can draw their data from a number of sources, from databases, feeds, other sites, and can refresh parts of the page at […]
You have probably heard of Web Vitals at some point in your life as a developer. Delivering a good user experience on the web is no trivial task, especially considering all of the major factors that need to be addressed for that to occur. This includes things such as website performance, accessibility, search engine optimization […]
As you design and developer your website, you become very familiar with the structure you use, the layout of the various pages, and the manner in which they are all tied together. Then, as time goes by, you add a little more here, a little more there, and sooner or later your small website has […]
There are plenty of build tools options in the current market – from Maven and Ant to Java, Gradle or the classic Make. But Grunt is different. It was done in JavaScript and focused on automating front-end tasks. If you, for example, want to follow good performance practices for websites, you should worry about minifying CSS […]
The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.
Advertiser Disclosure: Some of the products that appear on
this site are from companies from which TechnologyAdvice
receives compensation. This compensation may impact how and
where products appear on this site including, for example,
the order in which they appear. TechnologyAdvice does not
include all companies or all types of products available in
the marketplace.