i want to know is there any inbuild function to add spaces in javascript after particular interval..!!? there is string '00009999' i want to add blank space 0000 9999 after every 4 digits.?
I run a math site and I just recently built a little program to generate math problems. When the user submits the correct answer the program changes the problem and all the steps/hints. Everything works fine except that during the change over there are all these weird blocks (same color as my background) (*FireFox Only). It only lasts for a couple of seconds, but it would be nicer if it smoothly replaced the problem. Here is the test site:
[URL]
writeProblem() is called when the user gets the right answer and asks for another problem:
var writeProblem = function(){ //these are neccessary after the first call to writeProblem. $(".steps").hide();
I am designing a dynamic web form, and all works fine except that I can’ t eliminate the ‘blank’ spaces that appears between the form elements when these are displayed or hidden. I mean for example, the long blank space that appears between the form submit button and the table rows displayed, because the other tables and form elements are hidden.
I attached the complete sample page so that you can see the ‘blank’ spaces I want to eliminate. These are the 'blank' spaces I want to eliminate:
1. When the page loads, a long blank space appears between the submit button and the table rows displayed. 2. When you select only the ‘Quality B’ checkbox, a long blank space appears between the ‘Product details’ title and the table rows displayed. 3. When you select both ‘Quality A’ and ‘Quality B’ checkboxes, a blank space appears between the table rows displayed. I want a blank space there, but smaller.
In all the cases I want the submit button just below (with a little blank space) the table rows displayed.
I would like to passwith the help of javascript empty non-mandatory fields to my perl script (and replace them with a custom value). The form mailer script only passes the mandatory fields. When non mandatory fields are filled , these are added to the list of passed field values, otherwise the list includes only the mandatory ones. I'd like to pass all values even the empty ones so that the person receiving the submitted data via email can easily export them to a database via a macro written by somebody else. Another requirement from client: The predefined values must not show up in the form fields when loading the page with the form.
How can I check for empty values as well as for tabs or blank spaces and replace each of these fields with a value = "not available"? I tried to do solve this for empty fields (no tabs, no blank spaces) but my solution does not work properly. It requires me to click the submit button 3 times before the form is submitted (because with every click the "not available" value is added in each empty field.
I have the following piece of code in use on a vBulletin forum:
function sel(postid,username) { if (document.getSelection) { var str = document.getSelection();
[Code].....
What this does is if the user highlights some text in a post and presses a button, it inserts the highlighted text into QUOTE tags within the Quick prely box.
This works fine...however, it doesn't check if the user has actually selected some text. Many users simply press the button thinking it will quote the entire post, when in fact it will simply insert some "blank" quote tags.
What would I need to add into this to check that some text has been selected, and return an alert if not?
Using jQuery v1.4.2, Firefox 3.6.6, Chrome 4.1, IE 6,7,8.
I'm using jQuery .css() function to get the value of the css attribute "background". The attribute has not previously been assigned a value (either in script or style sheet).
e.g. alert($(this).css("background"));
In Firefox and Chrome, the return value is an empty string (""). However in IE 6,7,8, the return value is "undefined".
Because css() in IE doesn't return a blank string, doing indexOf() raises an error.
cross-browser scripting compatibility, for jQuery to return a blank string *for all browsers* if the css attribute isn't set. Otherwise we have to check for both "" or "undefined" which is the sort of pain jQuery users are trying to avoid.
This is probably the stupidest question ever. I know in java you can take advantage of a number being an int (not double) and divide by something without getting a remainder. But in javascript you dont declare what kind of variable something is.
So my problem is: Given any double or triple digit number, how do i get all but the last digit. Like if i have 13, I need to make an int with 1. If it's 103 i need one with 10.
I'm trying to keep a copy of a variable at 4 digits. This is what I came up with. page = 100 function makeit4digits(){ page4digit = page if (page<10){ page4digit = "000"+ page } else if (page<100){ page4digit = "00"+ page } else if (page<1000) { page4digit = "0"+ page }}
I am making a form validator which has some field like "credit card number" and "credit card security code". I need to make sure that those fields only contain digit, no alphabet and any others characters like "." , "," , etc.
Here is my code: <html> <head> <title>JQuery FOrm Test</title> <style type="text/css"> body { font: 11px/15px verdana, arial, helvetica, sans-serif; }
I'm currently using formchek.js to validate various form fields, however, I cannot figure out how to validate a field with a numeric range of 6-10 digits. I apologize in advance for asking such a question since I'm using formchek.js, but my strength is server-side programming not JavaScript.
I am working on my personal portfolio site, and am using a code that will make each portfolio piece appear in a new div when the name of the piece is clicked on. The problem is, JS does not seem to recognize double digits. I am not familiar with JS at all, I just got comfortable with CSS/HTML a few weeks ago! I am in over my head. It would really.how to change the code so that I could make about 15 to 20 divs instead of 9. Here is the code...
I would like to write a parser like the one below except I would like it to take characters with the the digits like 345j, 982p0, what would I change to be able to have characters with numbers?
I'm looking for a regular expression that will match everything in this string before 546 so that I can replace it with an empty string and just be left with 546. The string could be of any length and contain any number of hyphens.
i am trying to check a character with another character which are in the same text box.when we are entering date,date in the first text box and month in another text box and year in another text box.now i want when i am trying to enter '0'in the character position when there is '0' at first character position it must raise an alert box as well as when i am trying to enter a digit greater than '1' at 2nd character position it must raise an alert box when there is '3' in the first character position.
I'm looking for a regular expression that will match everything in this string before 546 so that I can replace it with an empty string and just be left with 546. The string could be of any length and contain any number of hyphens.
I have a calendar that I have got working, however I want the calender to have double digits at all times, 01, 02 etc not 1,2 as it is at the moment, i have been playing around with the code but can't figure out which bit effects it.
Code JavaScript: function buildCal(m, y, cM, cH, cDW, cD, brdr){ var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];