I have a nice little Javascript that capitalizes each field in my form
submissions. It looks like this:
<cfscript>
function CapFirst(str) {
var result = Trim(str);
var wordCount = ListLen(result," ");
var ProperString = "";
for(i=1;i LTE wordCount;i=i+1) {
ProperString = ProperString & " " & UCase(Left(ListGetAt(result,i,"
"),1)) & LCase(RemoveChars(ListGetAt(result,i," "),1,1));
} ProperString = Trim(ProperString);
return ProperString;}
</cfscript>
Then I display the results as follows:
#CapFirst(Session.Customer.FirstName)#
It works fantastic, except for some reason on my final form submission,
if someone enters an apostrophe in the field, it wants to repeat it 8
times. So the name "O'Brien" will look like "O''''''''brien". I can
live with the second character being lowercase, but the repeating
apostrophe's have to go.
A common javascript function that capitalizes input as user types (onkeypress) no longer works as of IE9Need a function that also works in IE 9 that doesn't not change method call or interface (as it's used in 150 places throughout application).
CALL: [CODE] el.onkeypress = function(el) { return c_capitalizeInput(el); } [CODE] FUNCTION: [CODE] // Intercepts keyboard input and capitalizes keystrokes. // Call with onkeypress="return capitalizeInput(event);" // Compatible with both IE and Netscape/Mozilla function c_capitalizeInput(evt) { evt = (evt) ? evt : ((window.event) ? window.event : ""); if (window.event) { // IE if ((evt.keyCode >= 97) && (evt.keyCode <= 122)) { evt.keyCode = evt.keyCode - 32; } return true; } else if (evt.which) { // Netscape and Mozilla key = evt.which; if ((key >= 97) && (key <= 122)) { key = key - 32; evt.target.value = evt.target.value + String.fromCharCode(key); return false; } return true; } else { return true; // Can't do anything for other browsers } } [CODE] How to make this work in IE9?
I need to capitalize user input from a text field by passing the data to an array and using the split() method, then then join() method and of course toUpperCase. I need to accomplish this with a loop. I only have a crappy ebook and haven't ever been in a java classroom.
Here's what I have which is not at all sufficient. I learn best from examples, so here I am... <HTML><HEAD> </HEAD><BODY> <FORM ACTION="#" NAME=strn> Enter lower case text <INPUT TYPE=TEXT NAME="txt1" SIZE=20> /
The following lines of code are just my attempts at guessing javascript logic/syntax function arrays(){ for (var i=0; i<secondarray.length; ++i)} firstarray=getElementByName.txt1 var secondarray =firstarray.split(separator[" ", 40]).toUpperCase(); /var secondarray.join([""]) <BR><BR> <INPUT TYPE=BUTTON VALUE="Convert to Upper Case" onclick="document.strn.txt2.value = document.strn.txt1.value.toUpperCase()" <BR><BR> <input type = "text" NAME=txt2 size=20/> </FORM></BODY></HTML> I know this much .array = string.split(separator[, limit]);.
Using the very basic jqModal example, isn't it supposed to auto size and auto center the modal on the page? I placed a table that was wider than the modal's default settings and it's off the page and does not create scroll bars on the page to see the hidden section of the modal.
The default class is
Now, I know I can change the width of the modal but what about the positioning?
I don't know if this can be done in Javascript, or requires any other language but i was wondering if this would be possible.I would like to embed this Javascript code in to a PHP file and then for it to run automatically upon the PHP file loading:
I have been looking for a way to open a PDF file and automatically locate and go to a certain phrase within the file. The phrase should only appear once within the file, if not, the first occurrance is all that is needed.
The file is needed to be opened from a website, into a new window. As it is opened, it needs to be sent the key phrase that it is looking for. I have no trouble choosing what phrase on the html side or opening the pdf file on its own. Note that the opening and finding of phrases would be done with Javascript on the html side.
Essentially what I am looking for is for the user to be able to click a link on the website. The site would open up the new pdf window containing the file and is automatically at the spot where the first phrase appears in the pdf.
However, I do not wish to attach any Javascript to the pdf file itself. The file may be changing over time by other users who may not have the expertise to deal with the javascript adding. At the moment, the original file is created in word and then transfered to PDF. So the PDF file name stays the same, as well as its location which would be in the same directory as the html file that links to it. But the contents of the PDF may change over time so I cannot add a Javascript to the pdf file.
Note that it may be possible if neccessary to add Javascript to the PDF. I may be able to get the users to edit the file in PDF mode but that is not a given.
I do not want a pop up window such as in the find option for the user to press before coming to the right location unless any other possible solution is not available.
In IE when autocomplete is working and the user picks the drop down in a Input text box, the password will appear giving the user quick access to the next step. But the cursor should occur to the right of the inserted "*"'s in the pasword box. But for me my cursor is just sitting at the end of the Input box I mentioned. I would like the cursor to sit at the end of the "*"'s in the password box.
I tried disabling the Input box and all that did is crash Internet Explorer plus it didn't put the cursor at the end of the "*"'s in the password box anyway. Any suggestions how I can get what is normal in this case?
I have a website on angelfire and they give me little access to the cgi-bin cause its a free site but they do have a form_handler_file & a form_handler_mail that i can use so there isnt much room to work with the only thing i did not like about it is that all the new additions to the File were at the bottom of the page instead of the top, so with the addition of this onload script, all is well.
It took exactly 17 9's to be compatible with firefox & IE and still scroll to the bottom of the page no matter how long the document was. I also put the page within an <iframe> so there is no problem on scrolling all the way back to the top just to navigate.
BTW i use the form_handler_file to make a news post so i dont have to always edit the news page and upload it everytime i have some new news to add.
I have a drop down box with 5 values in it. I am trying to figure out how I can make it so that as soon as a user selects a option from the drop down, it will load a certian page. With out them having to submit a forum. Can this be done.
Does anyone know how I can have it so when a user types in one box, it will auto tab to the next box when that box has been completed or reached its max length.
I have a form that has 3 inputs for the phone number (XXX) - (XXX) - (XXXX)
how can I get the number boxes to work so that as the user is putting in their number is automatically goes to the next box? For example, when I put in my area code "909" I have to TAB or click into the next box. How can I make it so it automatically goes to the next box?
I have ran into some sites that must have an AUTO bookmark feature. After I visited it added a bookmark automatically. It only worked in IE 5.5 Do you know a script to do this if so where can I find a way to stop it.
For instance, Box A has a blank entry and I enter in 5. Box B I enter in 6 so in Box C it should automatically give me 11 (if the code I put in is to add box A and B). Then in Box D I put in 3 (say to subtract from A and B combined) so then Box C adjusts to give me 8.
Don't worry about the math as that's all taken care of it, I just need to be able to know how to update on the fly like this.
Situation : - A form (method : POST, action : itself, onsubmit : alert 'Submit' ) - Got 2 submit button ( 'Save' , 'View') - Got navigation 1|2|3|4
What I want to do : - Once clicked on the navigation page, it will save the page without need to click on 'Save' button. Currently, if i manually clicked on the 'Save' button; it will save the page.
What have I done : - tried using js form.submit(); not submitted coz no alert comes out - tried using js button.click(); submitted coz got the alert, but it didnt trigger the function to Save the form.
I have a registration form for classes. Each class has a fee. I have a drop down box whereby the user chooses his class. There is a textbox with the associated fee. I would like to auto populate the fee textbox depending on what class the user chooses. In the email, the value of the drop down box has to be the name of the class and the value of the fee text box has to be the fee. Can someone please help me in accomplishing this?
I'm quite new at Javascript and I'm trying to create a script that will save me a lot of time when creating my website. I'm gonna try to explain what I'm looking for by taking a simple example. I have a page 'Portfolio'. On this page I have thumbnails of my work. 'OnMouseOver' will have the bigger version of the image appear on the screen (no need for a click). The images are named 1001, 1002, 1003, etc. The thumbs are named 1001_th, 1002_th, etc.
When I click on one of the thumbnails, I want the page "Details" to open, on which only the picture and the description is different for every project. The rest of the content will be the same every time. What I am trying to do is avoid having to create a page "Details" for each one of my projects (up to 100 and growing).I figure there must be a simple solution to 'take' the number of the picture and put it in a standard "Details" page.
I am appending an image via Javascript but IE6 will NOT consistently resize the image to its natural width and height. The exact dimensions of the image vary but are always 100x100 or less.ave tried using CSS like {width:auto;height:auto;} but this is not reliable. I append "?" + now.getMilliseconds() to the image SRC to prevent the browser caching it (because the image can change but the filename doesn't). If I omit this query string, then IE6 seems to resize the images correctly.I also have to float the image and I've noticed that removing the float fixes the problem. I tried to use display:inline instead of float but it didn't work.
Does anyone know of the coding he used to get his pages to load like they do (auto scrolling right) I would like to do this with a site I'm building but vertical.
How to make a form that automatic tab when we paste something into the box and sort it out automatically. Like cd-key box. When we copy n paste cd-key into the box it automatic inert everything into correct places.
<ul id="nav"> <li><a href="#1">his is a long piece of text which will need to be truncated.</a></li> <li><a href="#2">This is a long piece of text which will need to be truncated.</a>