Write an HTML page that contains a selection box with a list of 5 countries. When the user selects a country, its capital should be printed next to the list. Add CSS to customize the properties of the font of the capital (color, bold and font size).
As we all know Javascript can change HTML content.One of javascript HTML method is getElementById()
As we all know Javascript can change HTML content.One of javascript HTML method is getElementById()
This example uses the method to "find" an HTML element (with id="txtSelectedCapital") and changes the element content (innerHTML) to "selectedValue":
dropDown.options[dropDown.selectedIndex].value;
This line allows us to select the drop down list value based on the index and store it in some variable for displaying in the browser.
No comments:
Post a Comment