gpt4 book ai didi

javascript - 尝试将变量与联系人详细信息连接起来。

转载 作者:行者123 更新时间:2023-11-28 03:14:32 26 4
gpt4 key购买 nike

有人可以帮我解决这个问题吗,我正在尝试实现一个下拉选择按钮,该按钮在单击后显示类(class)的相关提供者,但是大多数类(class)都有多个提供者(6-8)

我让我的所有提供者都通过一个变量,当我尝试连接时,结果为空白。

有人可以帮忙吗,将不胜感激。

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>

<body>
<label for="programSelect"> Please choose a Programme<br><br></label>
<select id="nearestStore">
<option value="noSelection">Please Select</option>
<option value="StudyP">Study Programmes</option>
<option value="Train">Traineeships</option>
<option value="Acc">Accountancy</option>
<option value="Agri">Agricultural and Land Based</option>
<option value="Anim">Animal Care</option>
<option value="Beauty">Beauty Therapy</option>
<option value="Busin">Business Improvement Tech</option>
<option value="Busina">Business Administration</option>
<option value="CallC">Call Centres</option>
<option value="Creative">Creative arts</option>
<option value="Construct">Construction</option>
<option value="Customer">Customer service</option>
<option value="Cyber">Cyber Security</option>
<option value="Early">Early years ChildCare & Education</option>
<option value="Electro">ElectroTechnical</option>
<option value="Electric">Electricity Industry</option>
</select>



<div id="phoneNumber"></div>

<script>
var nearestStore = document.getElementById("nearestStore"),
phoneNumber = document.getElementById("phoneNumber"),

contactdetails = {
noSelection: "",
StudyP: "<br><a href='http://www.howcollege.ac.uk'>Heart of Worcestershire College</a><br>Emily Leleu<br>01905 743587<br>",

Train: "<br><a href='http://www.howcollege.ac.uk'>Heart of Worcestershire College</a><br>Emily Leleu<br>01905 743587",


}

nearestStore.onchange = function(){
phoneNumber.innerHTML = contactdetails[this.value];
contactdetails.StudyP: += '<a href='http://www.warwickshire.ac.uk/colleges/henley-in-arden.aspx'>Henley in Arden College</a><br>Personname<br>number<br><br>';

}



</script>

最佳答案

你形成字符串的方式是错误的,它与单引号('')和双引号(“”)有关。而且,你有一个冒号 (:)。修改后的行是

contactdetails.StudyP += "<a href='http://www.warwickshire.ac.uk/colleges/henley-in-arden.aspx'>Henley in Arden College</a><br>Personname<br>number<br><br>";

用这个替换你的行。

关于javascript - 尝试将变量与联系人详细信息连接起来。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28894227/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com