HTML - Dynamic Buttons
Hello,
I am using a loop to dynamically generate buttons using the <button> tag. The value for this button is populated using a variable. When I click on one of these buttons, I want the content of the button to be displayed on the text field. But, because it is in a loop and the because the value is a variable only the value of the 1st button comes in and then disappears from the text field. The javascript I am trying out to populate the text field is : function passButtonValue() { poitem= document.getElementById("poitem"); hiddenField = document.getElementById("hiddenField"); hiddenField.value = poitem.innerHTML; } I am using ABAP for getting the values and running the loop How can I reprogram it to overcome this problem? Thanks! Similar TutorialsI've played around with this code but it seems as if I can't get the buttons to appear. Is this related to the script type? Anyone know how I can fix this? [the location is not set yet, my problem is just getting the buttons to show up] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE> Meats </TITLE> </HEAD> <BODY> <SCRIPT type="text/javascript"> <table> <table border="1" align="center" cellpadding="1" cellspacing="1" BGCOLOR=blue > <tr> <td> <INPUT type="button" value="Home" name="button1"onClick="window.location='http://www.htm'"> <td> <INPUT type="button" value="History" name="button2" onClick="window.location='http://steakslocation.htm'"> <td> <INPUT type="button" value="Residents" name="button3" onClick="window.location='http://porklocation.htm'"> <td> <INPUT type="button" value="Events" name="button4" onClick="window.location='http://poultrylocation.htm'"> <td> <INPUT type="button" value="Links" name="button5" onClick="window.location='http://venisonlocation.htm'"> </SCRIPT type="text/javascript"> <div id="PICTURE"> <img src="anthropormophic_bacon.jpg" height="90%" width="90%" alt="Buddy!" /> <center> Y Halo Thar </center> </div> </table> The content of the document...... </BODY> </HTML> I am making a simple calculator program for a school science fair project, and I used a CSS Button Maker program that I got fro ma google search, and when I try to change my buttons from the normal preset ones to the one I made, it disrupts the onClick, and makes he buttons not work. any idea on how to fix this? Here is before the change to the cool buttons: Code: <HTML> <HEAD> <TITLE>Gavin's Science Fair Project</TITLE> <script LANGUAGE="JavaScript"> function CalculateSum(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A + B; } function CalculateDif(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A - B; } function CalculatePro(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A * B; } function CalculateQuo(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A % B; } function ClearForm(form) { form.input_A.value = ""; form.input_B.value = ""; form.Answer.value = ""; } // end of JavaScript functions --> </SCRIPT> <style type="text/css"> input.groovybutton { font-size:15px; width: 250px; height: 25px; font-family:Comic Sans MS,sans-serif; font-weight:bold; color:#000000; background-color:#FF0066; border-style:outset; } </style> </HEAD> <DIV ALIGN=CENTER> <table border="10" bgcolor="#0C6AA1"> <tr> <td><P><FONT SIZE="+3">Simple Calculator</FONT></P> <FORM NAME="Calculator" METHOD="post"> <P>Enter a number: <INPUT TYPE=TEXT NAME="input_A" SIZE=15></P> <P>Enter a number: <INPUT TYPE=TEXT NAME="input_B" SIZE=14></P> <DIV ALIGN=CENTER><P><INPUT TYPE="button" VALUE="Add Numbers" name="AddButton" onClick="CalculateSum(this.form.input_A.value, this.form.input_B.value, this.form)"></P> <P><INPUT TYPE="button" VALUE="Subtract Numbers" name="SubButton" onClick="CalculateDif(this.form.input_A.value, this.form.input_B.value, this.form)"></P> <P><INPUT TYPE="button" VALUE="Multiply Numbers" name="MultButton" onClick="CalculatePro(this.form.input_A.value, this.form.input_B.value, this.form)"></P> <P><INPUT TYPE="button" VALUE="Divide Numbers" name="DivButton" onClick="CalculateQuo(this.form.input_A.value, this.form.input_B.value, this.form)"></P> <P><INPUT TYPE="button" VALUE="Clear Fields" name="ClearButton" onClick="ClearForm(this.form)"></P></DIV> <P>Answer = <INPUT TYPE=TEXT NAME="Answer" SIZE=18></P> </FORM></td> </DIV> </BODY> </HTML> And here is after: Code: <HTML> <HEAD> <TITLE>Gavin's Science Fair Project</TITLE> <script LANGUAGE="JavaScript"> function CalculateSum(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A + B; } function CalculateDif(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A - B; } function CalculatePro(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A * B; } function CalculateQuo(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(Btext); form.Answer.value = A % B; } function ClearForm(form) { form.input_A.value = ""; form.input_B.value = ""; form.Answer.value = ""; } // end of JavaScript functions --> </SCRIPT> <style type="text/css"> input.groovybutton { font-size:15px; width: 250px; height: 25px; font-family:Comic Sans MS,sans-serif; font-weight:bold; color:#000000; background-color:#FF0066; border-style:outset; } </style> </HEAD> <DIV ALIGN=CENTER> <table border="10" bgcolor="#0C6AA1"> <tr> <td><P><FONT SIZE="+3">Simple Calculator</FONT></P> <FORM NAME="Calculator" METHOD="post"> <P>Enter a number: <INPUT TYPE=TEXT NAME="input_A" SIZE=15></P> <P>Enter a number: <INPUT TYPE=TEXT NAME="input_B" SIZE=15></P> <form name="groovyform"> <input type="button" name="AddButon" class="groovybutton" value="Add Numbers" onClick="CalculateSum(this.form.input_A.value, this.form.input_B.value, this.form)" title=""> </form> <form name="groovyform"> <input type="button" name="SubButton" class="groovybutton" value="Subtract Numbers" onClick="CalculateDif(this.form.input_A.value, this.form.input_B.value, this.form)" title=""> </form> <form name="groovyform"> <input type="button" name="DivButton" class="groovybutton" value="Divide Numbers" onClick="CalculateQuo(this.form.input_A.value, this.form.input_B.value, this.form)" title=""> </form> <form name="groovyform"> <input type="button" name="MultButton" class="groovybutton" value="Multiply Numbers" onClick="CalculatePro(this.form.input_A.value, this.form.input_B.value, this.form)" title=""> </form> <form name="groovyform"> <input type="button" name="ClearButton" class="groovybutton" value="Clear Fields" onClick="ClearForm(this.form)" title=""> </form> <P>Answer = <INPUT TYPE=TEXT NAME="Answer" SIZE=18></P> </FORM></td> </DIV> </BODY> </HTML> If anyone can help with this, It would be greatly appreciated. Hey All, Well, I'm having some difficulty with buttons on my page. I've decided to add Google search to my website. However, I can't get the submit button to look right. Rather than the button appearing as shown in the photo directly below, it comes up looking like the button in the second photo below. I know this is a minor detail, but it's really bugging me and I can't figure out what's going on. Even if I go directly to Googles website, copy the source code, and paste it directly into my HTML editor (Frontpage 2003) the button still comes up looking like the one in the second picture. Any help would be greatly appreciated. Thanks! Tim www.corvette-restoration.com Ok, ive made the background i want to use on photoshop and im using freewebs for now just to host my website. I've set the background to centre and top, and i am now trying to edit the site on frontpage. I need to put a button in that links to the main page from the first entrance page, which is easier enough. But i need the button to stay centered just below the logo, which is what i need help with. If you dont understand what i mean take a look yourself... http://www.freewebs.com/endofsyrum I need a "Click to Enter" button inbetween the bottom of the page and the bottom of the logo, and i would like it to stay there no matter what screen res or size fo window... Many Thanks, Narc Hi Guys/Ladies Im working through CSS learning it and so far its going well but i am stuck on this issue and a refuse to turn back to Html Tables etc i want to learn how to code without tables So i have a horizontal Menu bar and i would like to populate it with buttons linking to different sections on the site there is already two buttons but you can see from the image they are both touching one another i need to space them out, the buttons arent finished i want to get the layout sorted first then start adding detail. This is the CSS for the menu bar. I added the background image. HTML Code: div.hideSkiplink { background-image: url('/images/BottomMenu.gif'); width:100%; } div.menu { padding: 4px 0px 4px 8px; } div.menu ul { list-style: none; margin: 0px; padding: 0px; width: auto; } div.menu ul li a, div.menu ul li a:visited { background-color: #465c71; border: 1px #4e667d solid; color: #dde4ec; display: block; line-height: 1.35em; padding: 4px 20px; text-decoration: none; white-space: nowrap; } div.menu ul li a:hover { background-color: #bfcbd6; color: #465c71; text-decoration: none; } div.menu ul li a:active { background-color: #465c71; color: #cfdbe6; text-decoration: none; } This is the code on the site master where im calling the CSS HTML Code: <div class="clear hideSkiplink"> <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/> <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/> </Items> </asp:Menu> </div> iv attached the image so you can see what its doing.... Hope some one can help me I would like to use images as links in my nav bar and im looking for a tutorial or some help with how to make the buttons change when diffrent actions are taken.. eg link visited hover active but i dont know how to change the properties of the link, if anyone can point me in the direction on how to do this either in CSS or in each web page i would be verry grateful i have looked around and havent been able to find anything So I'm extremely new to HTML and I am trying to make a button open new tabs to two sites. Here is what I got so far: HTML Code: <a href='http://www.planetminecraft.com' title='Planet Minecraft : Supporting our Addiction!'><img src='http://www.planetminecraft.com/images/banners/planet_minecraft_mb.gif' border='0' alt='Planet Minecraft Banner'></a> Very new to html but i've downloaded several Paypal buttons and put the code into my web page. My problem is i want the buttons to run along the page side by side horizontally with spaces between them but they are running top to bottom. I have tried different ways to try and solve the problem but none have worked. Can anyone tell me what i have to do? thanks i have my list of radio buttons and submit button but what i would like to do is have each one go to a different URL but im having trouble with that at the moment so if anyone could help it would be very appreciated. thankyou sorry if this is a noobish question but so far i have this button.... <input type="button" value=">"/> i want to create a button that has the equivalent "^" arrow, but using rotation of the text used in my initial code? is this possible? what is this technique called? thanks for the help in advanced -Nathan I've created a form with a submit button and another button. The submit button is tied to the action of the form and the other button is to "register" or just send the user to another URL. It works fine in Firefox but not in IE...Any ideas? Code is below... Code: <form method="post" action="allow.php"> <table style="width: 100%; height: 100%" cellspacing="1"> <tr> <td class="un">USERNAME: </td> <td class="in"><input name="username" type="text" class="input"/></td> <td class="un">PASSWORD: </td> <td class="in"><input name="password" type="password" class="input"/></td> <td class="goblock"> <input name="submit" type="submit" value="Login" class="go"/><a href="http://digiconmediagroup.com/Homeplate/portal/register.php"><input name="register" type="button" value="Register" class="gor"/></a></td> </tr> </table> </form> 3 easy questions for my site i need help with. www.waykiwayki.com bear in mind i am from the planet noobian in the solar system noobianestnoobies. when i click download it opens the PDF, i want it to save e.g. with the standard "open or save" popup. the code says <a href="./Wayki Wayki.pdf"> so its just a link at the moment. i would like this button to launch a small popup too (another html file). the donation button i want to link to my paypal account, does anyone know the code for this and where to put it e.g. between what tags? also how do i give the browser a title (not 'untitled'). i am using the 'WYSIWYG web builder' and I am rubbish you are all great and i want off panet noobian :-) I'm trying to use an image as a button. I.e. create my own buttons. I can't use input because it creates it's own button and using the <button> makes my button on top of that grey button. Burrito. I'm new to this stuff. Could I be using javascript. And if so, do I use some sort of identifyer in header or can I put it in the document? Hey, as you can tell, I'm a new guy. And I'm having a bit of a problem... For some reason, in between 2 buttons I have on my site, there is a little, underscore line. I don't know why it's there, as it's not in my code, it's not a part of the image, and it wasn't there before I added the second button. It's hard to explain, it's easier to see it for yourself. http://nickisawesome.izfree.com/meec...igns/index.php Any help would be appreciated Hi I have the following code for part of my page: <!--BEGIN SCREEN Fios --> <div id='sfios' style="display:none;" > <div id="comcast"> <h2>Questions</h2> <p><span class="required">*</span> indicates required fields</p> <table id="Table1" class="questionTable" style="border-top: 1px solid gray; padding: 0px;" cellspacing="0" cellpadding="0"> <tr> <td style="padding:0px; width:100%; border-bottom:0px;"> <div id="otherDetails10" style="margin: 0px; padding:0px; width:100%;" > <div id="otherDetails11" style="display: ; padding: 0px; width:100%;" > <table class="questionTable" style="width:100%;"> <tr valign="top"> <td width="80%"> <strong id="Strong1"><span class="required">*</span>Do all the following use Fios?</strong><br /> <table id="houseHoldTbl" > <tr> <td> <strong>Household members :</strong> </td> </tr> <tr> <td>ABC DEF</td> </tr> <tr> <td>GHI JKL</td> </tr> <tr> <td>MNO PQRS</td> </tr> <tr> <td>TUV WUX</td> </tr> </table> </td> <td width="20%" style="text-align: center;"> <span> <input type="radio" name="use1" id="USyes1" onclick="show('otherDetails12'); show('contBut'); disableMe('contBut');window.scrollTo(getPos(qust1).x,getPos(qust1).y);" /> <label for="USyes1">Yes</label> <input type="radio" name="nouse1" id="NUSno1" onclick="show('contBut');hide('otherDetails12'); enableMe('contBut');window.scrollTo(getPos(qust1).x,getPos(qust1).y);" /> <label for="NUSno1">No</label> </span> </td> </tr> </table> <div id="otherDetails12" style="display: none; padding: 0px;"> <table class="questionTable" style="width:100%;"> <tr valign="top"> <td width="80%"> <strong id="Strong2"><span class="required">*</span>Does anyone else use the Television?</strong> </td> <td width="20%" style="text-align: center;"> <span> <input type="radio" name="why1" id="WHYyes1" onclick="hide('otherDetails13'); enableMe ('contBut'); window.scrollTo(getPos(qust1).x,getPos(qust3).y);" /> <label for="WHYyes1">Yes</label> <input type="radio" name="whyo1" id="WHYno1" onclick="show('otherDetails13'); disableMe ('contBut'); window.scrollTo(getPos(qust1).x,getPos(qust3).y);" /> <label for="LAno2">No</label> </span> </td> </tr> </table> <div id="ContButCTR" align="center" > <input type="button" name="priorpage" value="Prior Page adress" onclick="javascript:switchid('ppa')" /> <input id="contBut" type="button" disabled name="continue" value="Continue family" onclick="javascript:switchid('rinfo')" /> </div> </div> </div> <!--END SCREEN --> My problem is that I would like the buttons to remain side by side once the first question is answered. I have tried using a div but it disregards the show/hide elements for the radio buttons and leaves them turned on the whole time. Is there anyway to get the buttons to stay side by side with or without a div? Does anyone know how to put (or if it's possible) form buttons into the legend of a field set? I tried searching but not really found much. The following snippet resulted in the text for the legend and the button from the form residing just inside the fieldset and not actually in the legend it self. The border of the fieldset then remained unbroken around the content of the fieldset: Code: <fieldset id="fieldset1"> <form action="nrt.php" method="post"> <input type="hidden" name="c_name" value="$c_name[0]" /> <legend> Editing page for class: <i>$c_name[0] <button id="button-submit_4" type="submit">(edit)</button> </i> </legend> </form> It's really annoying because the page would look pretty damn neat if I could get the button in the legend. Any help here or anything would be very much appreciated Hi. I'm new to this site so i'm sorry if i posted the thread in the wrong part of the forum. Anyhow. I'm pretty new to HTML and CSS and wonder. How do i make, goodlookin' buttons? I want them to interact when hoovering over them with the mousepointer. I would be SO greatful if someone could help me out. Thanks I have found these sample html codes but I think these are lacking. I am just a newbie but I know how to trace html codes. <FORM ACTION="../cgi-bin/mycgi.pl"> What size pizza?<P> <INPUT TYPE=RADIO NAME="pizzasize" VALUE="S">small<BR> <INPUT TYPE=RADIO NAME="pizzasize" VALUE="M">medium<BR> <INPUT TYPE=RADIO NAME="pizzasize" VALUE="L">large<P> <INPUT TYPE=SUBMIT VALUE="submit"> </FORM> Thanks, Magiclouie hi im new to this site and was wondering if anyone could help me. i need to built a html page that will be sent out to clients. it will have some writing on it and at the end will have three buttons or check boxes. when a client click on button or check box an email will be sent back tell us what he chose. any one any ideas how to do this So, I'm building a homepage and recently exported a button created in fireworks. When I open the file in it's own window and view it works great, actions and all. However, when I insert the fireworks html file into what I've coded already for the homepage the image shows up but without actions. The javascript code was not inserted. I understand that the javascript code must be present for the rollover actions to occur but don't understand why this wouldn't be inserted when I insert the fireworks html file. Can someone clarify this for me. Must I copy this code over manually from the other html file and paste in the homepage file for it to work? I've never run into this problem before. Thanks for the help... |