Question

In: Computer Science

Hello, How can we create two buttons in a single page side by side through html?And...

Hello,

How can we create two buttons in a single page side by side through html?And how can we enter different data for different buttons, so that if i click 1st button it should show specific data and if i click second it should show other data?

Solutions

Expert Solution

1. This uses two different javascript functions which are called from two different button clicks and display data using javascript alert box .

<html>
<head>
<script type="text/javascript">
function firstData()
{
alert("Bhaskar");
return true ;
}
function secondData()
{
alert("Kumar");
return true ;
}
</script>
</head>
<body>
<h1> Welcome </h1>

<button onclick="JavaScript:firstData()"/>First

Data</button>
<button onclick="JavaScript:secondData()"/>Second

Data</button>

</body>
</html>   

2. This uses two different javascript functions which are called from two different button clicks and display data within the html body by using the id of areas for display .

<html>
<head>
<script type="text/javascript">
function firstData()
{
document.getElementById

("FD").innerHTML="Bhaskar";
return true ;
}
function secondData()
{
document.getElementById

("SD").innerHTML="Kumar";
return true ;
}
</script>
</head>
<body>
<h1> Welcome </h1>
<p id="FD"></p>
<p id="SD"></p>
<button onclick="JavaScript:firstData()">First

Data</button>
<button onclick="JavaScript:secondData()">First

Data</button>

</body>
</html>   


Related Solutions

(a) Create a HTML page for a single faceted search selector. It will include the name...
(a) Create a HTML page for a single faceted search selector. It will include the name of the facet and a list of radio buttons or tick boxes for each category. (b) Add a button called filter. When the button is clicked the radio button or tick boxes will be read to determine if a selection has been made. The selection will be written to a div element located under the filterbutton. If no selection was made, then an appropriate...
In html create a Watchlist page in which a user can create as many watchlist as...
In html create a Watchlist page in which a user can create as many watchlist as they wish. This page will contain the list of watchlist, allow the user to create a new watchlist, and delete an existing one. You have to implement the following: a) A list of all the watchlist that a user has created. For now, you can randomly create few. b) An option to create a new watchlist. Make sure you ask the user what the...
Create 1 HTML page and 1 CSS file for all the styles. Your html page will...
Create 1 HTML page and 1 CSS file for all the styles. Your html page will be a small gallery of images using the Polaroid style. The page should have at least 1 row of 3 images. You can choose any theme of images. Don't pick random images, make them all have a theme. Add an h1 tag for the header of your page. Style the h1 tag with a color, size, and font family. Include a paragraph tag under...
Hello! Html question. I am trying to add a background to a page. How would i...
Hello! Html question. I am trying to add a background to a page. How would i do this? I have tried using a jpg. The code is posted below. i used the background-image: url function. Any help of different ways to do this would be appreciated! Thank you! CODE: <!DOCTYPE html> <html> <head> <style> ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } li { float: left; } li a { display: block; color: white; text-align:...
The code to create a Search/Filter Data with Javascript or html from html page.
The code to create a Search/Filter Data with Javascript or html from html page.
Create following webpage in HTML : 1. Login Page This is the first page the user...
Create following webpage in HTML : 1. Login Page This is the first page the user should see. The user can login, signup, or continue as a guest. Your task is to implement the following features: a) Signup form This form should collect the information required for creating a new account on your movie database website. At the least, it should collect an email address, username, avatar image/graphic, first name, last name, and a password. You can ask for more...
HTML Create a page of texts that uses inline elements. The page should contain a citation,...
HTML Create a page of texts that uses inline elements. The page should contain a citation, a term definition, a subscript, a superscript and some highlighted texts.
Please provide HTML code for the following: - Create a page that lists a set of...
Please provide HTML code for the following: - Create a page that lists a set of audio files and shows their duration - Create a page that lists a set of video files and plays a different video when you click on the play icon
Treating the two web pages as two views of a Single Page Application (SPA), create the...
Treating the two web pages as two views of a Single Page Application (SPA), create the SPA with two views, one shows what the page in any one question displays and the other shows what the page in other questions  displays
Using brackets you will need to create the HTML page and CSS style sheet for the...
Using brackets you will need to create the HTML page and CSS style sheet for the given Form example. Form 1: create an HTML page with a form that contains a text input field. The label for the text field should be “City”. Beneath it should be a submit button “Lookup”. Place a horizontal line beneath the Lookup button and add three radio buttons labeled “Beginner”, “Intermediate”, and “Advanced”. Your page should have a title and a header in the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT