Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

javascript - HTML / Javascript输入问题(HTML/Javascript Input Issue)

What I'm trying to do is simple.

(我想做的很简单。)

I would like to take the input from an HTML page and use an if statement to select a certain range of numbers.

(我想从HTML页面获取输入,并使用if语句选择一定范围的数字。)

The problem that I'm having is it keeps on outputting "incorrect input".

(我遇到的问题是它不断输出“错误输入”。)

HTML

(的HTML)

javascript

(javascript)

  ask by bstrohl translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Firstly, on the if condition, change lng and lat to theLng and theLat because they are undefined.

(首先,在if条件下,将lng和lat更改为theLng和theLat,因为它们未定义。)

Then, to get the value you have to use .value , like so :

(然后,要获取值,您必须使用.value ,如下所示:)

const theLat = document.getElementById('lat').value;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...