Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Scripting language Interviews:AngularJSAngularJS DeveloperChrome FrameDojoExpert Developer JavaScriptExpert JavaScript DeveloperExt CoreEXT-GWTExt-JSFront End Developer (AngularJS)JQuery DeveloperjQuery MobileJQuery ProgrammerJQuery UIMooToolsPrototype FrameworkQooxdooScriptingSencha TouchSizzle Selector EngineSWFObjectWeb Font LoaderXMLHttpRequest
Copyright © 2018. All Rights Reserved
Expert JavaScript Developer 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.
< form action=" " name=" buttonsGalore" method=" get" >
Your Name: < input type=" text" name=" mytext" />
< br />
< input type=" submit" value=" GO!" />
< input type=" reset" value=" Clear All" />
< /form>
Another useful approach is to set the " type" to " button" and use the " onclick" event.
< script type=" text/javascript" >
function displayHero(button) {
alert(" Your hero is " " +button.value+" " ." )
}
< /script>
< form action=" " name=" buttonsGalore" method=" get" >
< fieldset style=" margin: 1em text-align: center " >
< legend> Select a Hero< /legend>
< input type=" button" value=" Agamemnon" onclick=" displayHero(this)" />
< input type=" button" value=" Achilles" onclick=" displayHero(this)" />
< input type=" button" value=" Hector" onclick=" displayHero(this)" />
< div style=" height: 1em " />
Submitted by:
< form action=" " name=" buttonsGalore" method=" get" >
Your Name: < input type=" text" name=" mytext" />
< br />
< input type=" submit" value=" GO!" />
< input type=" reset" value=" Clear All" />
< /form>
Another useful approach is to set the " type" to " button" and use the " onclick" event.
< script type=" text/javascript" >
function displayHero(button) {
alert(" Your hero is " " +button.value+" " ." )
}
< /script>
< form action=" " name=" buttonsGalore" method=" get" >
< fieldset style=" margin: 1em text-align: center " >
< legend> Select a Hero< /legend>
< input type=" button" value=" Agamemnon" onclick=" displayHero(this)" />
< input type=" button" value=" Achilles" onclick=" displayHero(this)" />
< input type=" button" value=" Hector" onclick=" displayHero(this)" />
< div style=" height: 1em " />
Submitted by:
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.