/    Sign up×
Community /Pin to ProfileBookmark

Javascript-Functions

I know HTML, but I am learning Javascript for work and I am running into a few snags. Any help would be appreciated.

I have used a Javascript function for temperature conversion(attached with an external js file). When the temp is converted we are supposed to get a message box if the temps fall under a certain amount.

Example: <90 degrees celcius : a message is supposed pop up.

I haven’t been able to code the message box correctly for it to work.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@pactor21Oct 10.2011 — Assuming you had some function that returns the converted temperature, and you saved it into a variable named, celcius.

function popup(celcius)
{
// Show an alert box when celcius is less than 90.
if(celcius &lt;90)
alert('Temperture fell below 90');
}


or if you wanted to pass the temperature threshold to the function as a second parameter, you could do this

function popup(celcius, threshold)
{
// Show an alert box when celcius is less than threshold.
if(celcius &lt; threshold)
alert('Temperture fell below the threshold. Heat up!');
}


Of course, celcius and threshold should be set before passed to the function.
Copy linkTweet thisAlerts:
@KorOct 10.2011 — Not related with the programming, but the measurement unit (temperature degree) is, in all the languages: [B]Cel[COLOR="Blue"]s[/COLOR]ius[/B], after the name of the famous Swedish astronomer and physicist. ?
×

Success!

Help @Newbiecoder11 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...