I can't seem to get an alert to show me anything. The eventual result is not an alert, but a document.write to post the url contents to various form fields for firstname= and lastname= etc.
I am really having a hard time using the document.write function, and am not sure how to employ it, whether in the same script statement or in a separate script in the body.
I was wondering if there was a way to dynamically read a field input and respond to it later in the form. My situation is this: I have a question that asks how many workers are employed at a business. Later in the form, the user is asked to add as many workers as they have (section with information on each worker) ..Is there a way I can have something echoed or document.write above the latter section saying "Please add (Number of workers listed above) sections for each worker employed"
I have been trying to write a script that allows a user to click on a button like a plus sign to add an additional field for a phone number when they have more than one phone number to enter. I have created a script that sort of does this. It doubles up what is already there, so, the first time, everything is fine, but after that I get a lot more fields than I want. I am a php programmer and not familiar enough with javascript to get to what I want. My script is included below. What I am doing here is retrieving the html content and then adding it to what is already there. In php I would use an if conditional test to see if the data has been retrieved.
The first time it would retrieve the data into a variable. After that it would not retrieve it. I think I am getting into some scope and sequence issues here. Javascript is a bit different than php in these regards. Also there is a commented line in the code that asks another question about the use of variables that I don't understand. I also tried using appendChild() here to no avail. I couldn't get that to work at all.
I have a JS which validates the correct format for postcodes (or zip) on an html form - works fine.But what I want to do is to use a JS to see if a website visitor is eligible for a particular service on their postcode / zip - ie the first general part on the code. For example if they type L15****, or L16**** or L18 (where the asterisk could be anything) it pops up the alert box with a message saying "Yes eligible" but any other code returns "No sorry not eligible" - eg L19**** it returns nope.I've tried hacking the code that validates to format and can manage it for just the first character - ie the L but I'm totally lost after that. I don't know if hacking the below will work.
I cannot findout how I can write to global variables in a a JQUERY function. <script type="text/javascript"> function checkusername (username ) { $.post("[URL]", { action: 5, username: username }, function(xml) { result = $("apot", xml).text(); //<-- this variable is not global... why ?? message = $("message", xml).text(); //<-- this variable is not global... why ?? alert(message); //<--here variables are shown ok alert(result); }); alert(message); //<--here variable is NULL !! alert(result); //<--here variable is NULL !! } </sctipt>
I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed and cause the form to fail.
I have a little bit of Javascript that runs fine, but I am trying to write some XML out so that it is the value of a hidden field. When I put it in the hidden field, it just shows the javascript instead of the value.
So, instead of showing the value of i++ it is showing <script>i++</script>
What I want it to show:
What it is showing
It works in the regular page, just not when I make it the value of the hidden form field. Sorry, kinda new to javascript.
this is my first thread here, but I've read your forum a lot as unregistered user. I've searched the web for a complete Javascript or some hint, but I didn't find an interesting script or article to implement what I've thought. There's a way to write text or number from the keyboard directly in a:
I am a newbie in this field and never have done any scripting as i dont belong to this field.Just now trying to learn html and javascript. I have written a very simple HTML code having a table containing some columns like market,account number,user id,racf id etc. Below given is my code:
Code: <html> <head> <title>E 1.3</title> <h3> Information regarding various markets is given below</h3> </head> <body ALINK="#FF0000" LINK="#0000FF" VLINK="#FF33FF" bgcolor="#FFFFCC"> <table border="1" bgcolor="#CCFFCC" cellpadding="2" cellspacing="5"> <thead> [Code]...
This code i completely html but i am posting here in javascript forum because i need a javascript function which can be embedded in this html code so that the columns account number and and user id become editable. Means: this code is not complete as of now.In account number and user id column i can enter at the max three strings for every market.The whole page will be static only except the account number and user id field in the table.My question is how to make this particular column editable.Means i need to have two buttons.Clicking first button makes the field editable and i can edit the column and when i click the other button eg:save or something then the cuesor automatically goes away and the page becomes uneditable until i click the first button.
i think this will help people a lot, cuz i couldn't find any simple answer by googling 3 hours...i need a very very simple jquery form field reset.here is the picture what i need:
HTML Code: <script type='text/javascript' src='http://code.jquery.com/jquery-1.6.4.min.js'></script> <script>
myNum[] is a hidden variable and partNum is the name of a text field that has many instances i mean there are many textfields with the same name so it forms a column in a data table.
The following form validation script works, currently if one of the five fields are completed, a message appears the remaining field(s) must be completed etc. Although the information the user has inputted in the first field is cleared. How can this information be available, if there is one problem in the form it doesn't make sense that the user must re-input all the information again. I look forward to hearing your response,
my javascript code is only validating one field at a time (as in it validates on field then submits the form, instead of going through the entire thing and then returning it as true and submitting it...) I'm not sure what to do to be honest, I've looked up google to no real avail.. my variables are declared in a seperate file to the actual even handlers and I have heaps of comments through out it, so please don't judge lol i'm still learning Quote:
//Event Registrations (Variable Declarations) found in validation_chkr.js //Validate Entire Form using validate_join() function validate_join()
I'm trying to write a generic/reusable form validator in Javascript... just something that checks to make sure required fields have a value. By generic I mean I don't want to explicitly reference the name/id of the form or the name of any of the data fields within a "validation" function.
if(problemFields.length > 0) { returnval = false; warn(problemFields); /* tells user they're missing a field, that's all */ }
return returnval; }
What I think is happening (not sure) is that the expression form[fieldsToValidate[i]] is not giving me what I want: a reference to the object corresponding to the form field with the same name. In otherwords, I must have some fundamental misunderstanding of how the DOM works here. Unfortunately, I can't seem to find a good enough reference to set me straight....
When users goes to my page (main window) and click on a link, it pops up a new window, and that window contains more links. When users click on the links on the popped up page, i want some text to be added into a textbox on the main window.
so like if the textbox has "Text1" and when user clicks on that link, the textbox will now have: "Text1 link.."
Is there a way I can calculate a field in a form based on another field in the same form. When clicking submit, both values should be posted to the next page. I want to be able to type in a value in one field, and automatically in a second field the value*1,36 should appear.
I have a site for property bookings with 2 calendars to enter start and end date. The calendar im using doesnt have any obvious facility to copy yhe date to 2 fields so each one has to be done, months in advance this can be a real pain.
Does anyone have any ideas how i can take the data inserted into one field and copy it to the second?
The form's drop down menu includes three cities (Calgary, Toronto, Vancouver). When the user presses "submit form", the script should create a cookie to store the user's city selection. Next time the user visits the site, they should be redirected to their city's site, ie. "/vancouver.html"
Right now, the code is returning an error from the onload("redirect();") function. The error indicates I am trying to redirect to "/[object HTMLSelectElement].html", but I am not sure if the trouble is in reading or writing the cookie. For simplicity, I've removed most of the other content from this page (my cookie.js is attached as a .doc):
I have a window (it's a modal dialog as well, but let's ignore that for now), where I need to write data into an iframe. Dynamically generated data. This data contains a form, this form is then sent to a server process, which expects it to be latin1 (iso-8859-1). It arrives as UTF-8. I have set the charset both in the container html (which contains the iframes) and the iframe in question to latin1, I once toyed with accept-charset of the form as well, all was ignored. So I started to recreate the experiment step by step.
HTML, meta tag text/html charset=iso-8859-1, FORM directly in it --> data is sent as latin1 Next I put the HTML for the form into its own HTML, put an iframe into the first documented and had its src point to the new HTML. Both the new and the old HTML had charset meta tags. Form was loaded into iframe, sent properly as latin1.
I removed both metatags, we're still sending as latin1. Next I thought it might have something to do with the dynamic nature of the iframe filling. I only assigned the iframe's src at runtime. Still, latin1.
Then I took the final step, and instead of reading an html into the src of the iframe, I wrote the code into the iframe with document.write. Everything LOOKED the same, but the server now receives the form data as UTF-8.
For this experiment I am using IE 5.5 (it is our compatibility base, another browser is not an option unfortunately - I'm a straight firefox man at home), and yes, the content has to be written into the iframe dynamically. I cannot create a temp file that I would load into it, or I would much rather not (it's a rather complex performance issue)
To clarify: Soon as I'm using document.write, all meta tags and or accept-charset (or what it was called) for the form are ignored completely.
I am trying to write a radio button form that has dynamic output. If radio 1 selected then the text would say "one", if radio 2 text = "two", etc. For example: How many chickens do you own? Radio 1 Radio 2 *Radio 3 Radio 4
I have the following and am stuck, can I stack getElementsbyid...? Code: <script type="text/javascript"> function check() { document.getElementById('Radio1').firstChild.nodeValue='one'; } <form> <input type="radio" value="0" id="r1" name="r1" onclick="check()" /> <input type="radio" ???? /> <input type="radio" ???? /> <input type="radio" ???? /> </form> I own <label for="r1" id="Radio1">blank</label> chickens.
I am totally new to jQuery and no good knowledge on javascript. However, I was assigned a task, to convert a javascript program to jQuery due to compatibility problem on browsers like Chrome and Safari. My program originally use javascript xmlDoc.load('....') to read XML file, and then use document.write statement to write html tables on client side. Something like this (the sample below may got lots of syntax problem as I jut want to show the major part):
Code: document.write('<TABLE >'); var y=x[0].getElementsByTagName('NoOfRows'); for (i=0; i<=noofrows-1 && i<=y.length-1; i++){ document.write(' <TD>'); document.write(z[j].getElementsByTagName('RecordDetails')[0].childNodes[0].nodeValue; }
Now I changed to use jQuery, I can read the XML file elements. However, when I try to write the table, it failed:
I have a form and if the user presses submit, and the "password" and "retypepwd" are the same. Does anyone know how, and where to include a variable that if "password" and "retypepwd" are the same, the page is redirected to success.htm and if they are not the same, fail.htm?
I have a client that has ads on her website that really slow down the site. These ads are called by an off site javascript file and I want to use a jQuery(document).ready or similar method to call these files after all of the site content has loaded. But these files contain document.write functions to add more javascript files. Since I want to load the files after everything else has loaded, this in turn makes the page blank and then loads the ad. Is there a way to position where document.write will write to?