Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Top World Wide Web Interviews:Action ScriptAJAXBasic InternetBloggingCascading Style Sheet CSSCSS3DHTMLDomain Name System (DNS)EcommerceHTMLHTML5JavaScriptjQueryjQuery KnockoutJSONJSONPUser Interface DesignerVBScriptW3CWeb 2.0 TechnologiesWeb 3.0 TechnologiesWeb BuildingWeb DevelopersWeb QualityWeb SecurityWeb SemanticWebmaster
Copyright © 2018. All Rights Reserved
JavaScript Interview Question:
How to add Buttons in JavaScript?
Submitted by: AdministratorThe most basic and ancient use of buttons are the " submit" and " clear" , which appear slightly before the Pleistocene period. Notice when the " GO!" button is pressed it submits itself to itself and appends the name in the URL.
<br>< form action=" " name=" buttonsGalore" method=" get" >
<br>Your Name: < input type=" text" name=" mytext" />
<br>< br />
<br>< input type=" submit" value=" GO!" />
<br>< input type=" reset" value=" Clear All" />
<br>< /form>
<br>
<br>Another useful approach is to set the " type" to " button" and use the " onclick" event.
<br>< script type=" text/javascript" >
<br>function displayHero(button) {
<br>alert(" Your hero is " " +button.value+" " ." )
<br>}
<br>< /script>
<br>
<br>< form action=" " name=" buttonsGalore" method=" get" >
<br>< fieldset style=" margin: 1em text-align: center " >
<br>< legend> Select a Hero< /legend>
<br>< input type=" button" value=" Agamemnon" onclick=" displayHero(this)" />
<br>< input type=" button" value=" Achilles" onclick=" displayHero(this)" />
<br>< input type=" button" value=" Hector" onclick=" displayHero(this)" />
<br>< div style=" height: 1em " />
Submitted by: Administrator
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.