[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
HTML and JAVA help
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 37
Thread images: 3
File: Assignment14.jpg (137 KB, 1273x749) Image search: [Google]
Assignment14.jpg
137 KB, 1273x749
Freshie Engineer here; this is for ENGR1. We have been working with HTML and Java. The body is HTML and the heading section has a function in Java. For this assignment, the user submits:
>Whether they want SI or English units as radio buttons
>Circle/Sphere/Cylinder in a drop-down select form
>radius and height in two separate dialogue boxes

The information is spit through a Java function outside of the body then replicated in a table below with the volume of their selected shape. Everything is working except for the volume. I am not sure if my variables/use is wrong for multiplaction or if I am not outputting the variables correctly.

Any suggestions?
>>
File: assignment14-2.jpg (75 KB, 875x833) Image search: [Google]
assignment14-2.jpg
75 KB, 875x833
This is my output
>>
>>51755575
I see your problem, you are mistakenly not working with java
>>
>>51755759
It is Javascript, which we are supposed to use in conjunction with HTML.

The only output that isn't working is for Volume
>>
Java != Javascript

For fuck's sake ...
>>
If you're too dumb to know what language you're using how is anyone supposed to be able to help you?
>>
>>51756179
Okay, simple Freudian slip, but still; how should I fix my output?
>>
>>51756236
>Freudian

lmao
>>
Post the actual code somewhere holy shit. How is anyone supposed to help you when you post a screenshot of your editor and you don't even show the part where the value is put on the page.
>>
>>51756236
thats not what a freudian slip is
go read your fucking lecture notes again
>>
>>51756383
Actually nevermind I actually read your code.

var RadiusValue = document.getElementById("radius");


This is used directly in your calculations:

VolValue = Math.PI * RadiusValue * RadiusValue * HeightValue;


But, you muppet, this is a DOM object, not a useful value. You need to get the actual value out of the input. Same for the HeightValue as well.
>>
>>51756236
>simple Freudian slip
You typed it like 5 times
>>
>>51756438
So,
VolValue = Math.PI * RadiusValue.value * RadiusValue.value * HeightValue.value;

?
>>
>>51756488
Yes, that would work. Though really you should just capture the value from the start because you're not doing anything else with those DOM objects.

var RadiusValue = document.getElementById("value").value;


In future, when you get 'undefined' you should at the very least console.log the values you're working with to see what's in them. Better, run through a debugger like the one in the Chrome dev tools.
>>
Unless you have a Professional Engineering certification you are not an engineer.

That is all.
>>
>>51756146
Thank you, I came here to say the same thing.
>>
>>51756633

Actually, that's not all:

You don't know the difference between JavaScript and Java, which probably means you're functionally retarded.
>>
>>51756633
>Unless you have a Professional Engineering certification you are not an engineer.
This.

That's my biggest gripe in this whole debacle, even more than confusing java and javascript
>>
>>51756555
>trips get

I added the .value to the getElementById statement, but it only resulted in the variables being undefined.

Is there an easy way to, as was suggested, post my code someplace relatively accessible?
I'm a /k/ and /biz/ frequenter, so not used to /g/'s format
>>
Here you go OP: http://pastebin.com/4ieqPyrT
>>
>>51755575
>assignment 14
Holy fucking shit. I just did this assignment last night.
>>
>>51757166
>http://pastebin.com/4ieqPyrT
Pitt?
>>
>>51757189
Shit, I fucked that up
>>
>>51757189
>>51756146
>>
>>51757115
The problem is that I cannot get the math to work. I go the if functions to work, but the multiplaction itself is not working. Thanks for site btw

http://pastebin.com/mdTjxWMz
>>
>>51757244
I noticed the error in the SI/English if statement and corrected it btw
>>
I havn't used Javascript much, but maybe you should use parseInt() on your values. You may just be trying to multiply strings.
>>
>>51757345
The variable is recognized as a string, but the multiplication still won't work. I don't think it's an issue with variables
>>
>>51757464
As a number, I mean
>>
OP, I got it to work. The output value for volume should be
document.getElementById("volValue").innerHTML = VolValue;

instead of
document.getElementById("volValue").innerHTML = VolValue.value;

thanks
>>51756438
>>51756555
>>51757115
>>
>>51755575
Yeah, fuck Java
>>
>>51756146
>Java !== Javascript
>inb4 refactored
noob
>>
File: prodev.png (150 KB, 896x656) Image search: [Google]
prodev.png
150 KB, 896x656
>>51755575
Do yourself a favour and start using === instead of == right away, there's a lot subtle bug's that can creep in if you don't.

>>51757166
>assignment 14
>Holy fucking shit. I just did this assignment last night.
I really hope you guys aren't getting tasks / producing code like this 14 assignments into a semester
>>
>>51758333
I shit Java code for a living so ...

!Java.equals(Javascript)
>>
>>51755575
FERI/FRI fag?
>>
>>51755575
Nice bait tho
>>
>>51760207
A wild slovene /g/entleman appears.
Thread replies: 37
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.