JavaScript - Help With Having The 'enter Text' Disappear Upon Selecting Form Field Box
In this Form field, when I select the field box that shows "Enter Text" I'd like it so the text disappears, so I can begin typing in a cleared field box. This is the line of code, I believe, that has to do with that function. Any help with having the Enter Text clear upon selecting, will be appreciated:
Code: <input autocomplete="off" id="keyword" name="keyword" value="Enter Text" onclick="clickclear(this, 'Enter Text')" onblur="clickrecall(this,'Enter Text')" /> Similar TutorialsHi, I'm hoping this will be an easy one for you experts out there. I am working on a convention registration form. What I'm trying to do is have the text "50.00" pop into the COST field when any text (even if it's only one character) is entered into the NAME field. If the text in the NAME field is deleted, the "50.00" should also be deleted. Does anyone have a script that does this? Thanks! Hey all, Objective: - when you select other the pull down menu is replaced by the text field. Currently: - Gotten it to the level of when you select the other the text field appears. Question: - HOw can I modify the code so when I select the other menu option from the pull down menu and it replaced by the text field? Quote: <script type="text/javascript"> function togglefield(val) { var o = document.getElementById('other'); (val == 'Other')? o.style.display = 'block' : o.style.display = 'none'; } </script> and the form: <form action="" method="post"> <select name="sel" id="sel" onChange="togglefield(this.value);"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="Other">Other</option> </select> <input type="text" name="other" id="other" style="display: none;"> </form> well title says it all i have a search form, and the default value is "enter text here" when the user click the submit button, i would like to check if the value of my text input is "enter text here" and if it is, then don't submit the form (popup a warning or something) how can i do that? thanks a lot! Hello Having problems with the following...a client needs me to replicate this contact page: http://www.ravenrow.org/contact/ In particular he wants the subscribe/unsubscribe to appear only when one enters text into the text field (as it does here). I have recently changed from using tables to div tags but this was the first website where I started to experiment with divs. Unfortunately therefore it is a mixture of tables and divs. But here is my page: http://www.rowingpresents.com/contact.html Can someone tell me what I need in my code to have to subscribe/unsubscribe appear and disappear as it does at ravenrow.org. Many thanks S Hi all, Thanks for reading. I'm having an issue trying to accomplish the following - I have a text field (field1) already displayed on the HTML page. However, there's a link where you can add additional text fields to the page as well. When the link is clicked, the second text field is added successfully (field2), and when the link is clicked again, the third text field (field3) is added successfully. However, the third field does not add itself to the page, and the text for anything greater than a third field also isn't displayed after. This obviously means that my "fields" variable is not working right, so I'm wondering, would anyone be able to assist me to help me get that variable processing correctly? Code: <script language="javascript"> fields = 1; function addMore() { if (fields = 1) { document.getElementById('addedMore').innerHTML = "<input type='text' name='field2' size='25' /> <span>Field 2.</span>"; fields = 2; } else if (fields = 2) { document.getElementById('addedMore').innerHTML = "<input type='text' name='field3' size='25' /> <span>Field 3.</span>"; fields = 3; } else { document.getElementById('addedMore').innerHTML = "Only 3 fields are allowed."; document.form.add.disabled=true; } } </script> Here is the code in my HTML - Code: <input type="text" name="field1" size="25" /> <span>Field 1.</span> <div id="addedMore"></div> <p class="addMore"><form name="add"><a onclick="addMore()">Add another field.</a></form></p> Thank you very much. I'm trying to figure out how to both make the text grey and when a user clicks inside a input field remove the helptext. So far I got this: Code: <input onfocus="this.select()" onblur="this.value=!this.value?'E-mail here':this.value;" name="name" value="E-mail here" type="text"> What this does is allmost correct, but it doesnt remove the predefined text "E-mail here", it just select it all, and then the text is not grey... Can somebody please guide me in the right direction... Thanks in advance! I am Gururaj. I have written a form in HTML which contains username,lastname,email,password and submit. I have written a javascript to validate this form [validate(username,lastname,email,password)]. On submit this javascript function will be called and hence form get validated. I am passing all the arguements(username,lastname,email and password) to the javascript function.. Is it possible to make me a code such that it should call an individual function for each field in the form.for ex:if i have not entered username, last name in the form and attempt to submit, only username arguement should be passed to the function as it comes first in the form. In other sense i want to validate individual text field validation of my form. So can anybody help me.It will be very needful to me. hi, I have a form with a tick at the end of each formfield: Code: <label>First Name<a href"#">click</a></label> <input class="text-input medium-input" type="text" id="medium-input" name="FirstName" /> <span class="input-notification success png_bg">Successful message</span> the style is currently set to display:none; I would like to use the FadeIn() method on the input-notification class when someone enters some text at the moment I am trying to test using a link to click on: Code: <script> $("a").click(function () { $("tab2").fadeIn(3000, function () { $("span").fadeIn(100); }); return false; }); </script> this doesn't work as I have 2 tabs and the link sends it back to tab1 Hi. I have developed a form all working fine but am struggling on the following. I need a checkbox for an item, when the checkbox is true the user can enter text in a text box, only if the checkbox is ticked. I have numerous items I need for this. Hope someone can help. Thanks Need help with my text box. I want to make it so if i have several text boxes only one number can be entered once. So if i type the number 15 in the first text box and type 15 in the second text box an error will occur saying you cant enter the same number twice. Any idea how to do this? Code: <html> <head> <title>Untitled Document</title> <script> function checkForInvalid(obj) { obj.value = obj.value.replace(/[^0-9\-]|(-{2,})/gi, (RegExp.$1.indexOf("-") > -1) ? "-" : ""); } </script> </head> <body> <form name="myForm"> <input type="text" name="one" onkeyup="checkForInvalid(this)"> <br> <input type="text" name="two" onkeyup="checkForInvalid(this)"> <br> <input type="text" name="three" onkeyup="checkForInvalid(this)"> </form> </body> </html> Thanks I have a very small script that simply displays a search box and redirects a user to a URL if they enter 29401 or 29455, else they go to a default page. The script works fine, but I cannot figure out how to make value="enter a zip code" in the input box so that it disappears when you click in the box. I also can't get the form to submit by pressing enter, you have to click "check". I can get all this working in straight HTML but the same won't work w/ javascript. Any help please? <SCRIPT LANGUAGE="JavaScript"> function zipValidate(){ val = document.zipForm.zip.value; switch(val){ case "29401": case "29455": document.location = 'http://www.gohere.com'; break; default: document.location = 'http://www.or-go-here.com'; break; } } </SCRIPT> <form name="zipForm" id="zipForm" method="post" action=""> <input name="zip" type="text" id="zip" maxlength="5" /> <input name="zipButton" type="button" id="zipButton" value="Check" onclick="zipValidate()" /> </form> Hi, Just wondering if you guys can help me to make the following script to work when the enter/return key is pressed, intead of having to click on the button? Code: <Script language=JavaScript> function read_model (form) { ModelVar =form.model_input.value; window.location= ("http://www.sony.co.uk/product/dsc-t-series/" + ModelVar + "/tab/technicalSpecs"); } </script> <form name=model_form action="" method=GET> Enter Sony Model Number (e.g. dsc-tx5): <input type=text name=model_input value="" size=9> <input type=button name=model_button value=Click onClick="read_model(this.form)"> </form> <script language=JavaScript> document.model_form.model_input.focus(); </script> I've searched the net for ways of achieving this, but for some reason none of the code i've tried works..! Also, if this make a difference, the page will mainly be used in Firefox. I'd be really greatfull if someone can help me with this, Thanks! I have a text field, call it income, that when the input is > 0 I need to dynamically show the next text box, and if it is blank hide the next text box. I would like to use onBlur but can't seem to get it to work. Can I do this? Help I am trying to get my form which is in PHP to submit when pressing the Enter key This is what I am using Code: <script type="text/javascript"> function submitFormWithEnter(myfield,e) { var keycode; if (window.event) { keycode = window.event.keyCode; } else if (e) { keycode = e.which; } else { return true; } if (keycode == 13) { myfield.form.submit(); return false; } else { return true; } } </script> PHP Code: <div id='aboutForm'> <span class='headerbox'><b>Your Profile Headline:</b></span> <span class='textbox'><input type='text' name='headline' class='zip' size='67 ' value='$headline' onKeyPress="return submitFormWithEnter(this,event)\"></span> </div> Anyway I can get this to work? Seems to be an issue with the "text" input Hi everyone. I'm 100% not a programmer so I need some help with this issue. We have a page for an e-mail newsletter sign up form. The site is built in Joomla. My question : is it possible for a URL link (from say, an email) to send a user to this sign up form and also to fill in a hidden value called channelmemberID? The code is
Code: <input type=hidden name="ChannelMemberID" value="101369"> and I would like to be able to change the value 101369 to anything else. Code samples would be generous and greatly appreciated. The sign up page is here temporarily hosted here http://seoul.directrouter.com/~dancker/?Itemid=82 My problem is the following. I have an editable <div>: <div class='edit' id='divContent' name='divContent' ContentEditable>some text</div> If I press 'enter' two lines are skipped. I know that if I press 'shift+enter' only one line will be skipped. If I check the unformatted code of the contenteditable div, 'enter' gives me <p> and 'shift+enter' gives me <br>, which makes sense because <p> is formatted differently than <br>. So I want to change 'enter' into 'shift+enter' I have already found something to capture and kill 'return' function killReturn() { key = event.keyCode; if (key == 13) return false; } But now for some means to replace the killed 'enter' with 'shift+enter'? Thanks a lot in advance for any advise! Hi I have a form setup so that when you enter something in a text field and click a button it checks to see if the value entered in the text field is the "correct" letter and if its right it changes the CSS property of a div container to be shown which then has a link to a the next question. So I don't really have a submit button because my form isn't setup to work with one. This is fine by me but the only problem is when you enter a letter and click enter it acts as a submit and the submit does nothing, which is what it's suppose to do. So what I'm asking is how can I get that button to respond to an enter instead of the default submit taking over the enter key? I have a form, which has a textarea. Though I'm wanting it to be able to submit with the enter key. Can anyone help me? Everything I've tried either refreshes, or does a linebreak. Heres the code to the whole page, seeing as the form takes up most of it. Code: <? require("scripts/function.s"); $username = $x; $password = $y; require("scripts/verify.s"); ?> <html> <head> <link rel=stylesheet type=text/css href=style.css> <script type="text/javascript" src="http://www.katarra.net/googiespell/AJS.js"></script> <script type="text/javascript" src="http://www.katarra.net/googiespell/googiespell.js"></script> <script type="text/javascript" src="http://www.katarra.net/googiespell/cookiesupport.js"></script> <script language=Javascript> function clearForm(f){ f.action.value = f.nonaction.value; f.nonaction.value = ""; return true; } </script> <script language="javascript" type="text/javascript"> setTimeout( function() { var mytext = document.getElementById("rptext"); mytext.focus(); mytext.select(); } , 1); </script> <style type="text/css"> <!-- a { text-decoration:none; } .style3 {font-size: larger} --> </style> </head> <body> <body onLoad = "focusIt()"> <script language="javascript" type="text/javascript"> //window.alert("hello"); function focusIt() { var mytext = document.getElementById("rptext"); mytext.focus(); } </script> <form action=main.php#thebottom method=post target=TOP name=theForm onSubmit="clearForm(theForm)"> <table width="204" border="0" align="left" cellpadding="10"> <tr> <td width="18" valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=look+at+$x\" target=\"TOP\" style=\"text-decoration:none\">APPEARANCE</a>" ?></div></td> <td width="18" valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=stats\" target=\"TOP\">STATS</a>" ?></div></td> <td width="18" valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=quests\" target=\"TOP\">QUESTS</a>" ?></div></td> <td width="18" valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=who\" target=\"TOP\">WHO</a>" ?></div></td> <td width="20" valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=description\" target=\"TOP\">DESCRIPTION</a>" ?></div></td> </tr> <tr> <td valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=settings\" target=\"TOP\">SETTINGS</a>" ?></div></td> <td valign="middle"><div align="center"><? echo "<a href=\"wiki\" target=\"_blank\">HELP</a>" ?></div></td> <td valign="middle"><div align="center"><? echo "<a href=\"main.php?username=$x&password=$y&action=listmail\" target=\"TOP\">MAIL</a>";?></div></td> <td colspan="2" valign="middle"><div align="center"><span class="style3"><? echo "<b><a href=\"main.php?username=$x&password=$y&action=quit\" target=\"TOP\"><u>LOG OUT</u></a></b>" ?></span></div> <div align="center"></div></td> </tr> </table> <table width="627" border="0" align="right" cellpadding="0"> <tr> <td width="132"><div align="right"><?$admin = get("admin");if($admin == "Y" || $admin == "Y+" || $admin === "special") echo "<a href=\"admin.php\" target=\"TOP\">ADMIN PANEL</a>";?> </div></td> <td width="317" rowspan="3"><div align="center"> <textarea name="nonaction" cols="50" rows="3" wrap="virtual" id="rptext" class="textarea"></textarea> </div></td> <td width="151"><div align="right"></div></td> </tr> <tr> <td><div align="right"> <?$admin = get("admin");if($admin == "Y+") echo "<input type=checkbox name=nolog>";?> </div></td> <td> <input type=submit value=SUBMIT> </a></td> </tr> <tr> <td><div align="right"> <? //<form action=main.php#thebottom method=post><input type=hidden name=username value=$x><input type=hidden name=password value=$y><input type=submit border=0 style=border:0;background-color:#006;color:#FF0;font-family:Tahoma; name=command value=Clear></form> //<a href=\"main.php?username=$x&password=$y&action=clear\" target=\"TOP\">Clear</a> ?> <? echo "<input type=button onclick=\"theForm.action.value='clear';theForm.submit();\" border=0 style=border:0;background-color:#000;color:#FF0;font-weight:bold; value=CLEAR>" ?></div></td> <td><div align="right"> <input type=hidden name=action value=""> <input type=hidden name=username value=<?=$x?>> <input type=hidden name=password value=<?=$y?>> </div></td> <br> </table> </FORM> <div align="center"> <p> </p> <p><a href="https://www.ixwebhosting.com/templates/ix/v2/affiliate/clickthru.cgi?id=jrdelaney" target="_blank"><img src="https://www.ixwebhosting.com/templates/ix/v2/images/banners/88x31-businessplus.gif" border=0 align="absmiddle"></a></p> </div> <script type="text/javascript"> var googie1 = new GoogieSpell("googiespell/", "http://www.katarra.net/sendReq.php?lang="); googie1.decorateTextarea("rptext"); </script> </body> </html> Greetings experts, this is my first time here. So, please take easy on me. I have makup with 2 sections. The first section contains 5 form fields and are required. The second second has 2 form fields and are optional. Users can only choose from one section or the other but not both. The js script below ensures that if users select from section 2, section one will not challenge for validation and works a treat. The challenge I have now is to ensure that if users choose from section 1, the 2 form fields in section are automatically disabled so they won't be attempted to choose from it. Similarly, if users select from section 2, all form fields in section one are automatically disabled so they won't be tempted to choose from that section. Is this possible? If not possible, is it possible to raise an error? For instance, a user selects from section 1 and attempts to select from any of the 2 form fields in section 2, a message that says, "You can only select from one section but from both. Similarly if a user selects from section 2 first, same thing happens. Thanks very much for your assistance. function validate() { if(document.getElementById("<%=txtrequest.ClientID%>").value != "" && document.getElementById("<%=txtreceived.ClientID %>").value != "") { if (document.getElementById("<%=txtName.ClientID%>").value == "") { alert("Please enter name"); document.getElementById("<%=txtName.ClientID%>").focus(); return false; } if (document.getElementById("<%=txtCity.ClientID %>").value == "") { alert("Please enter city"); document.getElementById("<%=txtCity.ClientID %>").focus(); return false; } if (document.getElementById("<%=txtState.ClientID%>").value == "") { alert("Please enter state"); document.getElementById("<%=txtState.ClientID%>").focus(); return false; } if (document.getElementById("<%=txtZip.ClientID%>").value == "") { alert("Please enter zip"); document.getElementById("<%=txtZip.ClientID%>").focus(); return false; } if (checkradio() == false) { alert("Please enter contacts"); document.getElementById("<%=txtContacts.ClientID%>").focus(); return false; } } return true; } I have 10 feedburner feeds that are for different categories on a wordpress site. I would like to modify the subscribe form code feedburner supplies to include radio buttons to select which of the feeds to subscribe to. Code: <HTML> <HEAD> <TITLE> Radio Window </TITLE> <script> function OpenWindow(){ for(i=0;i<document.FormName["RB1"].length;i++){ if(document.FormName["RB1"][i].checked){ window.open(document.FormName["RB1"][i].value); break; } } } </script> </HEAD> <BODY> <form name="FormName" style="border:1px solid #ccc;padding:3px;text-align:center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="OpenWindow()";return true"> <p>Enter your email address:</p><p><input type="text" style="width:140px" name="email"/></p> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed1&loc=en_US">Option 1<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed2&loc=en_US">Option 2<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed3&loc=en_US">Option 3<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed4&loc=en_US">Option 4<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed5&loc=en_US">Option 5<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed6&loc=en_US">Option 6<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed7&loc=en_US">Option 7<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed8&loc=en_US">Option 8<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed9&loc=en_US">Option 9<BR> <input type="radio" name="RB1" value="http://feedburner.google.com/fb/a/mailverify?uri=feed10&loc=en_US">Option 10<BR> <input type="submit" value="Subscribe"> </form> </BODY> </HTML> This is the code I have put together searching the web, when hitting the subscribe button after entering a email address and selecting an option it load two new windows, one for the relevant feed but does not transfer the email address entered in the text box. The second for to http://feedburner.google.com/fb/a/mailverify All help would be greatly received. |