-
Notifications
You must be signed in to change notification settings - Fork 0
/
stopid.js
46 lines (38 loc) · 999 Bytes
/
stopid.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function myFunction(stopid){
var y= document.getElementById('myForm').elements[0].value;
var id=document.getElementById('id');
var x;
if (y==="ohlone2home") {
id.innerHTML=stopid;
x = '51577';
}
else if (y==="jollibee2home") {
id.innerHTML=stopid;
x='52253';
}
else if (y==="home2ul") {
id.innerHTML=stopid;
x='58774';
}
else if (y==="home2ohlone"){
id.innerHTML=stopid;
x='52633';
}
else if (y==="ws2ohlone"){
id.innerHTML=stopid;
x='55277';
}
//create a link
var text=document.createTextNode(stopid);
//id.appendChild(text);
var newA=document.createElement('a');
var href=document.createAttribute('href');
var target=document.createAttribute('target');
target.value="_blank";
newA.setAttributeNode(target);
href.value="https://511.org/transitdepartures/"+x;
newA.setAttributeNode(href);
var linkname = document.createTextNode(x);
newA.appendChild(linkname);
id.appendChild(newA);
}