提问人:Webmaster website 提问时间:6/26/2023 更新时间:6/26/2023 访问量:11
我有 3 个文本框用于输入,我需要能够使用其中任何/所有文本框运行搜索,以将用户发送到正确的外部网页
I have 3 textboxes for input and I need to be able to run a search using any/all of them to sent the user to the correct outside webpage
问:
我知道足够多的编程,知道这是可能的。这就是我正在挣扎的方式。我有 3 个输入文本框,每个文本框都需要用于运行搜索。这意味着我有 3 个变量。这是否意味着我需要 3 个不同的函数,或者我可以在 1 个函数中做到这一点?我该如何让它工作?有没有更简单的方法来对为变量 b 和 c 输入的单词的多种变体进行编码?我需要能够对覆盖区域内的所有邮政编码、城市和县进行编码,并将它们链接到不同的外部网页(变量将转到 5 个可能的网页)任何关于使其更容易的建议将不胜感激。
else if (c == "bell county") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
h1 {text-align: center;}
p {text-align: center;}
</style>
<title>Find your nearest Meeting </title>
</head>
<body>
<h1><b>Finding your nearest meeting</b></h1>
<p>When leaving your treatment center and going back home, it is importaint to find your nearest AA meeting as soon
as possible.<br>
The Area 26 Treatment Committee wants to make this easy for you.
Please type in your zipcode <b><i>OR</i></b> your city <b><i>OR</i></b> your county in <i><u>one</u></i> of the
boxes below.<br>
You will then be directed to the Intergroup meeting webpage that serves that area.
Here you will be able to locate a meeting and continue your journey in sobrity.<br>
Remeber, <i>We shall be with you in the Fellowship of the Spirit, and you will surely meet some of us as you
trudge the
Road of Happy Destiny.</i>
</p>
<br><br>
<center><label for="Zipcode">Zipcode:</label></center>
<center><input type="text" id="Zipcode" name="Zipcode"></center>
<p id="Zipcode_text"></p>
<br>
<p><b><i>OR</i></b></p>
<br>
<center><label for="City">City:</label></center>
<center><input type="text" id="City" name="City"></center>
<p id="City_text"></p>
<br>
<p><b><i>OR</i></b></p>
<br>
<center><label for="County">County:</label></center>
<center><input type="text" id="County" name="County"></center>
<p id="County_text"></p>
<br><br><br>
<center><button onclick="myFunction()">Find Meetings Near Me</button></center>
<script>
function myFunction() {
var a = document.getElementById("Zipcode").value;
var b = document.getElementById("City").value;
var c = document.getElementById("County").value;
if (a == "41310") {
document.getElementById("Zipcode_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (a == "41317") {
document.getElementById("Zipcode_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (b == "Rousseau") {
document.getElementById("City_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (b == "rousseau") {
document.getElementById("City_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (b == "Vancleve") {
document.getElementById("City_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (b == "vancleve") {
document.getElementById("City_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (b == "Van Cleve") {
document.getElementById("City_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
if (c == "Bell county") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (c == "Bell") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (c == "bell") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (c == "Harlan County") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (c == "Harlan county") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (c == "Harlan") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else if (c == "harlan") {
document.getElementById("County_text").innerHTML = "Thank you. You will be directed to the Bluegrass Intergroup's Meeting page";
// <a href=""> Bluegrass Intergroup Meeting Page</a>;
window.open("", 'newwindow')
}
else {
document.getElementById("County_text").innerHTML = "I'm sorry but we have not found a local Intergroup Meeting Page that has meetings in that area. Please go to the Area 26 meeting page for a list of meetings in Kentucky, Southern Indiana and Ohio.";
// <a href=""> Area 26 Find A Meeting Page</a>;
window.open("", 'newwindow')
}
}
</script>
</body>
</html>
当我在文本框中输入任何编码答案并点击按钮时,没有任何反应。当我删除变量 b 和 c 并只在变量 a 上运行时,它就可以工作了。所以我在编码变量 b 和 c 时做错了什么。
我删除了外部网页地址,因为 Stack Overflow 说我的问题是垃圾邮件
答: 暂无答案
评论