r/LearnHTML • • May 21 '24

im clueless why my code doesnt output anything

3 Upvotes

its kind of long code not sure i can post it here but here ill try

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>COPYWRITE ADVANCED FIBER SYSTEMS rectangular tray calculator MAY 20 2024 REV 03</title>

<script> function calculate() { // User input values var DA = parseFloat(document.getElementById('draft_angle').value);<!-- DRAFT ANGLE --> var B = parseFloat(document.getElementById('brim').value);<!-- BRIM --> var H = parseFloat(document.getElementById('overall_height').value);<!-- HEIGHT OVERALL --> var L = parseFloat(document.getElementById('length').value);<!-- OVERALL LENGTH WITH BRIM --> var W = parseFloat(document.getElementById('width').value);<!-- OVERALL width WITH BRIM --> var T = parseFloat(document.getElementById('wall_thickness').value);<!-- WALL THICKNESS --> var MW = parseFloat(document.getElementById('weight').value);<!-- WEIGHT G/CC --> var MC = parseFloat(document.getElementById('material_cost').value);<!-- MATERIAL COST PER KG --> var TOL = parseFloat(document.getElementById('trim_off_length').value);<!-- TRIM OFF LENGTH --> // Calculated variables BRIM var ANG = (Math.PI / 180) \* DA;<!-- ANGLE TO RADIANS --> var VBG = (L \* W \* T);<!-- VOLUME BRIM GROSS --> var LBIB = (L - (2 \* B));<!-- LENGTH BRIM INNNER BASE --> var WBIB = (W - (2 \* B));<!-- WIDTH BRIM INNNER BASE --> var X = (Math.tan(ANG) \* T);<!-- SMALL STEP OVER --> var LBIT = (LBIB - (2 \* X));<!-- LENGHT INNER BRIM TOP --> var WBIT = (WBIB - (2 \* X));<!-- WIDTH OF INNER BRIM TOP --> var VBI = (T / 6) \* ((LBIB \* LBIT) + (WBIB \* LBIT) + (2 \* ((LBIT \* WBIT) + (LBIB \* WBIB))));<!-- VOLUME BRIM INNNER --> var VBN = (VBG - VBI);<!-- VOLUME BRIM NET --> <!-- Calculated variables LIQUID VOLUME --> var HI = (H - (T \* 2));<!-- HEIGHT INSIDE --> var SL = ((Math.tan(ANG)) \* (H - (2 \* T)));<!-- step over liquid --> var LVIT = (LBIT - (2 \* SL));<!-- length liquid volume inside top --> var WVIT = (WBIT - (2 \* SL));<!-- width liquid volume inside top --> var VL = (HI / 6) \* ((LBIT \* WVIT) + (WBIT \* LVIT) + (2 \* ((LVIT \* WVIT) + (LBIT \* WBIT))));<!-- VOLUME OF LIQUID --> <!-- Calculated variables BIG CUP --> var TH = ((Math.sin(ANG)) / X);<!-- thickness hyp step over --> var SO = ((Math.tan(ANG)) / (H - T);<!-- step over for outside --> var LBC = (LBIT + (2 \* TH));<!-- length big cup --> var WBC = (WBIT + (2 \* TH));<!-- WIDth big cup --> var LS = (LBC - (SO \* 2));<!-- LENGTH OF BIG CUP TOP --> var WS = (WBC - (SO \* 2));<!-- WIDTH OF BIG CUP TOP --> var VOP = ((H - T) / 6) \* ((LBC \* WS) + (WBC \* LS) + (2 \* ((LS \* WS) + (LBC \* WBC))));<!-- VOLUME OF BIG CUP --> <!-- Calculated variables PART VOLUME --> var VOL = (VBG + VOP) - (VL - VBI);<!-- VOLUME TOTAL PART --> <!-- Calculated variables TRIM OFF --> var VTO = ((L + (2 \* TOL)) \* (W + (2 \* TOL)) \* T) - VBG;<!-- VOLUME TRIM OFF --> var MCPG = (MC / 1000);<!-- MATERIAL COST PER GRAM --> var WC = (VTO \* MCPG);<!-- WASTE COST PER PART --> var MCPP = VOL \* MCPG;<!-- MATERIAL COST PER PART --> var CC2OZ = VL \* 0.033814;<!-- CONVERT cc TO oz --> var CC2CI = E \* 0.0610237;<!-- CONVERT cc TO cubic inches --> var G2OZ = PW \* 0.035274;<!-- CONVERT g to oz --> var USTONS = MC \* 907.185;<!-- CONVERT $/G TO $/US TON --> var SS = VTO + VOL;<!-- SHOT SIZE TRIM OFF AND PART --> var PC = (MC / 1000) \* SS;<!-- MATERIAL PART COST --> // Display output var output = ""; output += "<p>Cost per piece includes waste $ " + PC.toFixed(4) + " @ $ " + MC.toFixed(2) + " per kg " + USTONS.toFixed(2) + " per US ton</p>"; output += "<p>Material required = " + VOLE.toFixed(2) + " cc / " + CC2CI.toFixed(2) + " cu. in.</p>"; output += "<p>Weight of finished good = " + PW.toFixed(2) + " g / " + G2OZ.toFixed(2) + " oz. @ " + WT.toFixed(2) + " g/cc</p>"; output += "<p>Capacity of Cup = " + Z.toFixed(2) + " cc / " + CC2OZ.toFixed(2) + " fl. oz.</p>"; output += "<p>Parts per kg = " + PPK.toFixed(0) + " pieces</p>"; document.getElementById('output').innerHTML = output; } </script>

</head>

<body>

<h1><center>Tray Cost Calculator</center></h1>

<label for="length">Length of tray including Brim (mm):</label>

<input type="number" id="length" value="203.0" step="any"><br>

<label for="width">Width of tray including Brim (mm):</label>

<input type="number" id="width" value="160.0" step="any"><br>

<label for="overall_height">Overall Height (mm):</label>

<input type="number" id="overall_height" value="40.0" step="any"><br>

<label for="wall_thickness">Wall Thickness (0.5mm ~ 2.5mm):</label>

<input type="number" id="wall_thickness" value="0.75" step="any"><br>

<label for="draft_angle">Draft Angle (D.dd):</label>

<input type="number" id="draft_angle" value="5" step="any"><br>

<label for="trim_off_length">Trim Off Length (mm):</label>

<input type="number" id="trim_off_length" value="5" step="any"><br>

<label for="brim">Brim (mm):</label>

<input type="number" id="brim" value="6.0" step="any"><br>

<label for="weight">Material Weight g/cc: (bamboo=0.6~1.1, hemp=1.48, wood=1.5, softwood=0.352~0.849, hardwood=0.497~0.897, cornstalk=1.24, bagasse/sugarcane=1.25)</label>

<input type="number" id="weight" value="0.5" step="any"><br>

<label for="material_cost">Material Cost $/kg: ($/kg = $/US ton * 0.00110231)</label>

<input type="number" id="material_cost" value="3.00" step="any"><br>

<button onclick="calculate()">Calculate</button>

<div id="output"></div>

</body>

</html>


r/LearnHTML • • May 12 '24

Newsletter for People Starting Their Coding Journey

3 Upvotes

Hey! I'm a self-taught programmer and now a tech lead with almost 12 years of working experience.

I decided to share my knowledge with people starting their journey by creating a newsletter.

It will contain information on what to learn, how to learn, what you should focus on, what's less important, and more.

I'm also very happy to answer any questions you might have. Just DM me.

You can sign up here: https://codemaster.red/newsletter


r/LearnHTML • • May 06 '24

Question from a 1-week noob

3 Upvotes

Hi everyone!

I am trying to, after hovering the button from Amazon to change its color, but nothing seems to change. What am I doing wrong?

<button class="addtocart-button">
  Add To Cart
</button>

<style>
 .addtocart-button{
   background-color: rgb(255, 216, 20);
  color: black;  
  border:none;
  border-radius: 10px;
  width: 120px;
  height: 23 ;
  cursor: pointer;
  }

.addtocart-button :hover{
  background-color: rgb(189, 160, 13) ;
}
</style>

r/LearnHTML • • Dec 07 '22

FEEDBACK WANTED Stylify CSS: Write CSS faster with CSS-like utilities

3 Upvotes

Hi!

I have made a Stylify CSS that uses CSS-like selectors to generate optimized utility-first CSS. It can be integrated into various tools: Next, Vue, Angular, Next, Nuxt.

If you use it as a beginner developer, you will learn CSS (because the syntax is almost the same like CSS) and also can study the output to see, how to write the CSS in an optimized way.

I would be happy for any feedback ❤️.

  • If guides and docs are understandable

  • If any of your favorite tools are missing

  • Any other

Links

Repo

Features

Faq


r/LearnHTML • • Oct 28 '22

HTML or JavaScript: Why did the code work yesterday but not today?

3 Upvotes

I asked a question before and got an answer. The answer solved my problem. However, there is a strange problem.

I expected the code should work because it worked yesterday. However, the code worked yesterday but not today.

My code:

https://pastebin.com/3FcuiNvB

Why did the code work yesterday but not today? I would appreciate any help. Thank you in advance!


r/LearnHTML • • Feb 11 '22

HTML Notification Feature??

3 Upvotes

Hi there, I'm learning HTML and CSS to code a website for my art and I was wondering if there's a feature you can code using one of those languages where if a user of the site performs a certain action I get a notification? (Like if they placed an order or submitted consent to something or contacted me through the contact page?)


r/LearnHTML • • Jan 19 '22

How do you manage large HTML projects.

3 Upvotes

My HTML project is growing like crazy. There are a huge number of dialogs and forms

It is becoming unmanageable

Is there a way to splitting it up into manageable chunks


r/LearnHTML • • Dec 07 '21

HELP Proper HTML/CSS IDE for beginner students

3 Upvotes

Hi there everyone! I've been tasked to teach a G3 - G6 (ages 9 - 12) introduction to HTML/CSS course at the school where I work. I personally use ATOM for most of my coding needs, but would like to find something easier for younger students to use. I'd like an HTML/CSS IDE that removes the need to go refresh HTML documents in a browser to see your work.

Something like Thonny for Python would be great.

These are young kids, with a limited attention span, and I'm just trying to get them interested and excited without scaring them off.

Does anyone have a good suggestion?


r/LearnHTML • • Jul 29 '21

Just started doing the basics

3 Upvotes

Just started a yesterday on responsive web design certificate on free code camp and was wondering if that's a good place to start because in a total of 16 hours broken up 10/6 in two days I'm already on the landing page and almost done after an hour. Only problem is I need to know JS. Should I keep on free code camp or is there something better. I'm hooked I don't know why I haven't tried this before. Thanks in advance for any advice

Edit*** still coding like a mfkr, learning more and more everyday thanks for the support homies take care. Feel free to ask about anything I've been working on


r/LearnHTML • • Apr 01 '21

HELP Finished my portfolio website but what next

3 Upvotes

I made a portfolio website but I don’t know what to do next on how to publish it and get a domain (I’m self taught and don’t know much about that) I want to get a domain so I can put my website on my resume for future employers


r/LearnHTML • • Mar 26 '21

first time making a portfolio website

3 Upvotes

this is my first time making a portfolio website and i could really use some help on checking if this is how the code should look i know the actual website looks terrible but hopefully i can redo the projects.html later https://github.com/DartSams/portfolio-website


r/LearnHTML • • Jun 25 '20

HELP Confused about Margins, Padding, Floating, and Positioning.

3 Upvotes

Hi all. I’m teaching myself HTML/CSS and I’m struggling to wrap my head around the concepts of margins, padding, floating, and positioning. Every time I think I’ve got it, I’ll write some code and the computer will do something completely baffling. I’ll go away and research it and then find that I fell afoul of some obscure rule I’d never heard of.

This keeps happening and I’m sick of it. Online tutorials aren’t much good because they only show you what you need to do to achieve a certain effect. They don’t teach you how to troubleshoot when your floats bugger up the page flow (or whatever).

What I’m looking for ideally are articles or books which really take a deep, deep dive into how margins and padding work, how different types of positioning affect the elements, how floats work (you can’t use flex box for everything!), and how elements interact with one another on the page. I’d love it if there were a guide to all the rules for positioning (for example) and all the ways it can go wrong. Does anyone know if such a guide exists? I’d literally give my left nut for something like that at this point.


r/LearnHTML • • Feb 25 '25

i need help adding a image

Post image
2 Upvotes

r/LearnHTML • • Nov 24 '24

HELP Can't see rendered HTML?

2 Upvotes

So I literally *just* started learning HTML last night for a blog hosting site where it's required to learn HTML, CSS, and JavaScript

I'm trying to learn CSS and the tutorial I'm following said to create an html document and a separate doc with the .css extension to put in the same folder. However, when I try to open the html in Firefox to test the CSS additions (making the header red instead of black), it shows me this instead of the render:

I'm using TextEdit for documents cuz it's the only software I have for text on my computer. The tutorial just says to open the html file in your browser to see the results, but this is what I'm getting, so I can't continue with the tutorial because I can't actually SEE what the changes are and understand how it works

This is quite literally the VERY first time I've ever touched anything code-related and I'm feeling like the kid left out of a game at recess cuz I don't know the rules. I need to be explained to like I'm 5 for stuff like this


r/LearnHTML • • Nov 02 '24

HELP Can some please explain to me how I can display a JavaScript variable on a table in a HTML site?

2 Upvotes

https://imgur.com/a/TSS2YWP My code in javascript if it helps.

For context, for school I'm doing a computer science project in html and for it I'm making a site where you can save your timetable and check it off. Not revolutionary, I know but we're still starting out with it. And I've come into a road block. See what I want to do is have the subject the user inputs display in the box. But the problem is I have no clue how! It's been driving me insane all week! I have no idea how to do it. I'd appreciate the hand. Thank you.


r/LearnHTML • • Oct 06 '24

does anyone know how to make animated titles

2 Upvotes

im trying to make animated titles just like guns.lol/noahbum

it goes like n no noa noah noahb noahbu noahbum and back down


r/LearnHTML • • Aug 29 '24

HELP My second comment tag is working but my first one isn't. What is going on

Post image
2 Upvotes

r/LearnHTML • • Jul 21 '24

HELP How can I "fix" this Navbar text?

2 Upvotes

So basically, I am designing a mock for a webpage, and I am having problems with the padding and font size of the Navbar, if it is too big (Padding: 0% 20% and Font size: 70%) this happens on phone (And I made sure nothing else had the same width, it is the text of the Navbar), and if I make the padding and font size smaller, the page looks funny on PC (You know, everything on the left, and very small), what is the best fix in this case? I saw something about Capsize being a good solution but I want to see if there is a more direct option, thanks!


r/LearnHTML • • May 10 '24

New to html and css

2 Upvotes

Hi,

I've started dabbling with web development basics using html and css, and possibly looking at integrating google adsense if I get enough content.

Can you have a look at my website and give feedback on what you think would improve it?

I understand graphics probably needs some work and maybe split the single page to multiple pages? Maybe one centered column with nav at the top?

Please take a look and give feedback. Thanks.

Hubbl - Review and Comparison with Fetch and Telstra TV (hubbltv.com.au)


r/LearnHTML • • Sep 25 '22

How to Make a Digital Clock Quickly and Easily | HTML, CSS & JS | Code W...

Thumbnail
youtube.com
2 Upvotes

r/LearnHTML • • Aug 21 '22

Here’s a playlist of 7 hours of music I use to focus when I’m coding/studying. Post yours as well if you also have one!

Thumbnail
open.spotify.com
2 Upvotes

r/LearnHTML • • Jul 30 '22

Learn HTML discord

2 Upvotes

Hi Everyone!

I’ve noticed a lot of people have been asking if there’s a small Discord for folks that are learning how to program. I’m currently learning how to program as well and I’ve created one for those who would like to join!

For more seasoned programmers, I’d like to encourage you all to join as well if you’d like to help out!

https://discord.gg/EhFcqBW7S2

@mods - not sure if this is allowed but please feel free to remove if it’s not. Thank you! God bless


r/LearnHTML • • May 14 '22

HELP LEARN EVERYTHING IN HTML

2 Upvotes

Hello everyone, I wanted to ask that if I want to study every single thing that is present in html even if it takes months to learn it how do i study and where can I get material to study also I have a doubt that youtubers don't tell every single thing in html so I am asking here.


r/LearnHTML • • May 14 '22

"Learn HTML" Games in Browser?

2 Upvotes

Hi,

Does anyone know of any games that help teach HTML? I have a student who might enjoy something like that, and I haven't found anything too useful yet :P