0% found this document useful (0 votes)
4 views2 pages

Tate Museum Artwork Selector Code

The document contains JavaScript code that retrieves artwork information from the 'Tate Museum Artworks' table, including titles, links, and artist names. It sets up a dropdown menu for users to select an artwork title, updating the displayed link and artist information accordingly. Additionally, it includes functionality to switch between two screens when specific buttons are clicked.

Uploaded by

mnirzhiy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Tate Museum Artwork Selector Code

The document contains JavaScript code that retrieves artwork information from the 'Tate Museum Artworks' table, including titles, links, and artist names. It sets up a dropdown menu for users to select an artwork title, updating the displayed link and artist information accordingly. Additionally, it includes functionality to switch between two screens when specific buttons are clicked.

Uploaded by

mnirzhiy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 // Get lists from the "Tate Museum Artworks" table

2 var artTitleList = getColumn("Tate Museum Artworks", "Artwork Title");


3 var linkList = getColumn("Tate Museum Artworks", "Webpage");
4 var artistFirstNameList = getColumn("Tate Museum Artworks", "Artist First Name");
5 var artistLastNameList = getColumn("Tate Museum Artworks", "Artist Last Name");
6
7 // Set the dropdown menu options using the artwork title list
8 setProperty("artWorkTitle", "options", artTitleList);
9
10 // When user selects a title from the dropdown, update the info
11 onEvent("artWorkTitle", "change", function() {
12 var selectedTitle = getText("artWorkTitle");
13 updateArtworkInfo(selectedTitle);
14 });
15
16 // Function to show link and artist info for selected title
17 function updateArtworkInfo(title) {
18 for (var i = 0; i < [Link]; i++) {
19 if (artTitleList[i] === title) {
20 setText("output", linkList[i]);
21 setText("artistName", artistFirstNameList[i] + " " + artistLastNameList[i]);
22 return;
23 }
24 }
25
26 // If no match found
27 setText("output", "No link available");
28 setText("artistName", "Unknown artist");
29 }
30
31 // Switch to screen2 when start button is clicked
32 onEvent("startButton", "click", function() {
33 setScreen("screen2");
34 });
35
36 // Switch to screen1 when home button is clicked
37 onEvent("homeButton", "click", function() {
38 setScreen("screen1");
39 });
40

[Link] 4/7/25 上午 9 53
码 1/2


:
PDF document made with [Link]

[Link] 4/7/25 上午 9 53
码 2/2


:

You might also like