I am working on creating a project and I need some help. I have 2 form boxes, one that displays text, and one that does not. What my goal is, is to have someone type the text displayed in the top form in the bottom one and have the word that they are typing highlighted in the display text. If someone type the word wrong, it will be red text in the bottom form. Code:
Where the inputs sum1 and sum2 are text fields you put whatever numbers you want in. That works fine. Great. Now what I'm having trouble with is modifying the code so that it will add one form with an input number with a form that spits out a randomly generated number.
This is what I'm using for my random number generator. So basically I want to be able to put, say, 5, into the input text field above this. And then click on the d20 button to get a random number, say, 15, and then have the first code add the inputted 5 with the randomly generated 15.
Basically what we are trying to accomplish is this... We have a php file in which a hyperlink "Select Forms" is present. What we want to happen is when the "Select Forms" link is clicked on a pop-up window will open. The content of this window is generated from our database and displayed for the user. The php in this window generates a list of checkboxes for the user to select and an "OK" button.
What we want to happen is when the user selects the various checkboxes and clicks "OK" the window closes and the previous "Select Forms" link is converted to text based on the checkboxes selected from the pop-up window. We have the pop-up window already taken care of, as well as the php codes. We are having a hard time getting the php variables for the checkboxes transferring to the previous window and converting that link to the text variables.
The following code will output numerical values only for the <label>. I need it to display text with multiple characters. For example: I own two exceptional chickens...I own four or more chickens...etc. Again the code works perfectly but only for numbers.
Code: <script type="text/javascript">// <![CDATA[ function check(x) { document.getElementById('Radio1').innerHTML = x; } // ]]></script> <form> <input id="r1" onclick="check(one big);" name="r1" type="radio" value="one" /> One <input id="r1" onclick="check(two exceptional);" name="r1" type="radio" value="two" /> Two <input id="r1" onclick="check(three terrific);" name="r1" type="radio" value="three" /> Three <input id="r1" onclick="check(four or more);" name="r1" type="radio" value="four" /> Four </form> I own <label id="Radio1" for="r1">blank</label> chickens.
First off, sorry if this is the wrong section. Adobe Forms isnt exactly Web Development, but its the only place I could find to post about javascript. If this isnt the correct section, Now, onto the question (please note, I am inexperienced with javascript). I have an Adobe form with a default text like this I have javascript that looks like this, so that when tabbing into the field, it skips past the default text:
function SetEnd (text) { if (text.createTextRange) { var FieldRange = text.createTextRange(); FieldRange.moveStart('character', text.value.length); FieldRange.collapse(); FieldRange.select(); } } SetEnd(this);
I was wondering if there is a way to make it so the default text cant be changed at all. Even better would be an alternative way of having the default text there but not "part" of the field, but at the same time, not being able to type over it either.
I'm trying to create a dynamic form, and for the most part it's working out fine.I'm using javascript with onclick and onchange on checkboxes and select boxes to change the form as the user makes selections.However, there's a few issues I'm running into that are giving me problems.
One is that when the user reloads the page, all of the javascript inserted or removed form elements are reset, but the choices on the checkboxes and select boxes aren't, which looks very strange to the user. How can I avoid this? I'm currently including scripts tags in the body of the html, but this is pretty messy and hard to manage. Is there a better way? Second is that I'd like to be able to insert javascript function declarations into text that is dynamically inserted by javascript.However, when I do so, the browser does not recognize the functions. The reason I'd like to do so is that I am using Ruby on Rails, and would like to be able to keep the scripts in the partials to which they relate. I have to use inline javascript, because the scripts are having element ids inserted based on Ruby variables. Is this a lost cause, or is there a technique that enables dynamically inserted javascript to be loaded?
Lastly, my dynamic form's javascript shows or hides portions based on what it encounters while loading. The main reason is that I want to show the whole form for users without javascript, and then hide advanced or obscure details unless they are activated with a checkbox on the form for users with javascript. However, this is creating a jarring pop-in effect, where on first load, the pre-javascript formatted page is shown for a split second, and then the javascript kicks in and fixes everything and the page visibly jumps and changes. Is there a way to avoid this to create a more polished effect?
I want to make few forms but 1 submit button. I want to do 1 page , 5 forms , 1 submit button so when i click on the submit button it will send the 5 forms as 1 form.
Using DOM in IE, how can I loop through FORMs and access FORM elements in a specific form? For example, www.hotmail.com has about 13 forms. I believe the one displayed is dependent on the URL. If I want to access the submit button of the visible form, which is usually the last one, how is that done?
Currently, I look for type=submit using DOM but it doesn't find anything and only loops through the first FORM elements.
I've been trying to teach myself JavaScript via a book and a number of JavaScript Tutorials Online. I have more understanding of what I am doing, although definetly not has much as what I have read on this newsgroup.
I'm trying to learn a new skill in order to hopefully get a job. My job went to india while I was out on medical leave (carpal tunnel.)
My question, I have two JavaScript / Htm pages identical to the one below. I'm trying to figure out how I could put both of these "identical" javascript pages into One HTM page. But I am clueless as to what to look for and or how to proceed. I'm thinking that I need to somehow add a checkbox_checker() and a checkbox_checker(2) or something like this.
I've looked at the "For Dummies" book on JavaScript, and my Beginning JavaScript Book as well as Google'd. Funny thing is though you have to have enough "knowledge" of JavaScript to know what to look for....
Is it possible to access the value of a radio button or change a radio button to enabled/disabled without using the forms tags<FORM></FORM>? In other words is the forms tag required for these actions?
i'm trying to use javascript to change the content of a textbox in a different frame.
by clicking on a 'folder' link in 'leftFrame' i want to put the value assigned by that link into the 'folderName' textbox in the 'uploadForm' form in 'mainFrame'. i'm doing this as...
this works perfectly fine with IE and Safari on my Mac OS X machine and IE 6 on my PC laptop but anything Mozilla-based on either machine gives me an error i just can't seem to get round...
I'm working on a simple Twitter app that checks whether a user is following another user, but I'm having trouble picking up on the inputted values in my form.
I've got this form on my page:
And using the form plugin, here's my JS:
The only thing that's being alerted is "username, username" and it's not registered text inputted into the fields at all.
i need to be able to select the year and according to the year only be able to select certin months.
i was thinking an if statement but (if year = 2006 then months= jan,mar,dec) sorta thing but i cant get that part working. any direction would be nice.
maybe there's an easier/different way to do this?
<script language="javascript">
function downloadForm(formMonth,formYear){ month = document.getElementById(formMonth).value; year= document.getElementById(formYear).value; location.href = "/pdf/qa/customer-satisfaction-leaderboards-" + year + "-" + month +".pdf"; }</script> Code:
I have to create a dynamic HTML page that actually contains two separate HTML forms.Can anyone tell me how can I create two forms in a single HTML page.
I'm not a JS person, so hopefully this'll be nice an easy .
The follwoing bit of code:
Code: <script language="javascript"> // if form exists , set cursor in first input field function focusonform() { if (document.forms[0]) { document.forms[0].elements[0].focus(); } else {window.focus();} } </script>
This appears to work fine on a page with no forms using Mozilla 1.0, IE6 on win2000. But NOT on IE6 on XP - I get the following message:
A Runtime Error has occured. Do you wish to Debug? Line: 70 Error: 'document.forms.0.elements.0'
I was wondering, I have several pages with different forms, these pages are in a frameset. I was wondering is there a Javscript I can put in a .js file that will set focus to the first form element in each page with out having to write a script for each page?
I am trying to create a form (a quiz to be exact) and I know how to create one in php. The only problem with this is that the location that I am planning on installing the quiz does not allow me php access, a cgi-bin or even internet access . Iam able to use html pages from a location stored on the desktop or in a network folder.
My idea is to have the first page be the actual quiz with the users selecting the answers. The following page (whether its a popup, text file, or a new page) would be where the answers are displayed and then ultimately printed to paper. Most of the scripts that I have found that would do something similar are email style scripts (I am unable to use this method)
This is what I have in php and is the type of format I am looking for in javascript. (I'm not very proficient in php as I just started and I have no clue about javascript) Code:
I'm embarking on a rather interesting wine cellaring project where I need to enable a user to add form fields (a complete table row with several fields) on demand.
If they start filling out the form and need another row for another bottle, I need them to be able to click a button that adds a new row to the table with the same fields.
I also need perhaps another button that will create the row and duplicate the form field values of that row. The winery, wine namen and variety may be the same but the year may change and I dont wan thte user to have to do any double entry. I've been researching DOM and have been looking at sites like Quirksmode.
Am I heading in the right direction? I'm just about to go an buy a book on DOM and start really getting into it.
From a drop-down box, the user chooses their country.
- User selects a country other than Australia, nothing happens.
- User selects Australia, another drop-down box appears with Australian states
* If they select a state other than Victoria, nothing happens
* If they select Victoria, another drop-down box appears with Region
I'd like the subsequent drop-down boxes to be either inactive and unclickable (technical terms here ) or not visible at all until the above conditions happen.
I need someone to point me to the write direction here. I know nothing of javascript, and I've tried looking everywhere I can on Google.
I have a drop down of all the sizes I have in a database. I call them to a form with the ID number as the value. What I want is when a user selects a size, it gets added to the table. For example:
<!--Repeat this bit with javascript according to the Paper/size chosen on the drop down --> <tr> <td>Glossy</td><td>4x6</td><td><input quantity form></td> </tr> <!--End repeat here -->