Easy Regex Question
Dec 4, 2003
How do I add blank space as acceptable in this expression?
//checks for numbers, - or space only
function checkPhone(frm,fld){
obj = eval("window.document."+frm+"."+fld);
tstval = obj.value;
re = /^[0-9-]+$/;
if(!tstval.match(re)) {
alert("Numbers or dashes only please.");
obj.focus();
return false; }
else { return true; }
}
View 4 Replies
ADVERTISEMENT
Jul 23, 2005
I know this has to be easy, but I can't seem to figure it out. I'm debuggin' someone elses code...
x="hello";
+x+"world"
....and I don't get it! What does the "+x+"world" do? If I alert(x) the only thing that comes out is "hello". I also wondered why it doesn't error without the ";" at the end of the line.
View 3 Replies
View Related
Jul 23, 2005
This is a novice question, but I'm stumped. I have a variable with a bunch
of text assigned to it. Now I want to email the value of the variable. I
have a simple form that asks for their name and emails that, but how do I
add the variable result?
View 3 Replies
View Related
Mar 17, 2011
I know nothing of js yet, I'm still studying CSS & PHP. So I'm just looking for a ready made script for vertical scrolling. I found one that does exactly that, but all the css styling is done in the javascipt, so I was completely lost. I want to be able to just enter the html (into the js array if neccessary, I can do that much lol) and have it scroll upwards, simple as that. The nearest thing I could find to what I want is this Creating a vertical content scroller using DHTML I can style my div & images myself, then all I need to do is enter the html and away it goes, but it functions just like the marquee tag in that it waits for the entire content to clear before it starts scrolling again.
View 5 Replies
View Related
Jul 23, 2005
I just finished developing a javascipt component allowing floating
captions to appear over HTML elements....
View 3 Replies
View Related
Feb 24, 2006
Form validation using JavaScript has never been as easy and simple! We
have developed a free generic form validation script that can validate
any form with very little JavaScript required in form!
For example:
A normal HTML form with out validation:
View 2 Replies
View Related
Feb 23, 2010
I was wondering if there was an easy way to configure a message box to resemble that of a login form.It would preferably have two text fields for username/password and OK and Cancel buttons as well.I currently have a normal login form on my website designed using PHP but it does not figure into what we need to do now. I'm not sure about going about this and I have tried looking for quite sometime for an example of this but cannot find one.
View 5 Replies
View Related
Nov 9, 2010
Can anyone recommend any easy-to-use and free JavaScript IDEs?
View 5 Replies
View Related
Jan 12, 2006
Is there a way to change a javascript's output on a website without directly manipulating the source code? Just by entering some info in a form, then hitting submit. Then it automatically changes the content of a website.
What I want to happen is to change some text (specifically a news ticker) on my javascript, located in between the head tags, just by inputting new information on a form which automatically replaces the old one.
View 3 Replies
View Related
Aug 6, 2011
I'm kind of new to js, I wanted to write some non english chars inside an array, and it only seems to work if I write unicode notation, e.g. "u1234" per char. I was wondering if there is some easier way to do this, maybe somehow specify to the browser that the js file is utf8-encoded or something similar, but I'm not sure how to do that.
View 3 Replies
View Related
Jan 18, 2011
I have inserted the easy slider code into my web page to make a sliding gallery. I attempted to modify the code so that numeric navigation AND arrow navigation (next, previous) could toggle slides BUT I can't see the number navigation in IE6. Every other browser I have tested (mac Safari, Firefox, and Google Chrome as well as IE7,8) work perfectly. Since I modified the original, I assume the error is in my javascript code OR in my CSS.Here is the Javascript:
/*
* Easy Slider 1.7 - jQuery plugin
*written by Alen Grakalic
*http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding[code]....
View 2 Replies
View Related
Jul 1, 2010
I need to make a website that will be used as a traffic light system. So i will have a page with loads of divs starting red, that will change to green when clicked once, and back to red if clicked again, so on, so on. These changes will need to be viewable live on another computer, so changes need to save and will also need to automatically refresh without distrubing the rest of the page.
View 22 Replies
View Related
May 3, 2006
I am looking to use a spell checker in my multi-field forms and am trying to
find something open source and easy to install and use.
It could be either AJAX, DHTML or Javascript.
View 3 Replies
View Related
Dec 26, 2011
make a div show() a few seconds after page load and to easy open slowly / > preview page
here is what I have tried
<
script type="text/javascript">
[code]....
View 1 Replies
View Related
Feb 13, 2010
The code is supposed to generate this: PS: This is generated by a PHP Function that the Ajax Load Method Calls.
[Code]...
I've been noticing a lot of problems when loading these stuff, Sometimes I have to remake the HTML Tags because its not showing anything. Is there any option? I want it to load EXACTLY how it is, I don't know if this is some kind of protection for bad code, but if it is I would like to disable. But also, this code is really clean. no problem, I don't know.
View 1 Replies
View Related
Jul 23, 2005
I have a function which validates the password if there is a number:
-------------------------------------------------
function findNumeric(str_obj){
regEx = /d/;
if (str_obj.match(regEx))
return true;
else
return false;
}
--------------------------------------------------
The problem arises when I put a password with a space in between e.g:
'test test1'. The fucntion returns false. I've tried 's' in the
regEx but the user can put the space anywhere..
Any idea how to solve this problem as I should be able to put any
alplanumeric value into the password, including space.
View 6 Replies
View Related
Jul 23, 2005
I have a variable named "acct". I first want to remove any "-" characters
from it's value. After this I want to verify that we have only exactly 12
digits in the variable.
Unfortunately I'm pretty green as far as using RegEx.
/d{12}/.test(acct); should do the second part, but how do I do the first?
View 4 Replies
View Related
Jan 9, 2006
Basically i want to get the current url, and then replace http:// with
something else.
Here is the current code.
var current_url = window.document.location;
var re = new RegExp("http://", "g");
if(re.test(current_url)) {
me = current_url.replace(re,"http://www.addme.com/");
window.alert("found :: " + me + " :: " + current_url);
} else {
window.alert("not");}
if my page was http://ww.google.com 'd get the alert to be:
found :: undefined :: http://www.google.com.
I dont understand why i am getting undefined. When re.test() works.
surely that means the regex is correct.
View 14 Replies
View Related
Jun 15, 2006
Trying to match the entire following object literal code using a RegEx.
var Punctuators = { '{' : 'LeftCurly', '}' : 'RightCurly' }
Variations on the idea of using /var.*{.*}/ of course stops at the
first }.
View 7 Replies
View Related
May 9, 2007
I was using the following code:
element.value = element.value.replace(/ /g,'');
to remove all the spaces in a string.
However in IE6 it complained with and "Expected ')'" error.
How can I tell IE6 to replace just spaces (i.e. not using s)?
I tried / / and /[ ]/ but neither of them worked either.
View 13 Replies
View Related
May 18, 2007
I need to strip everything from a file except what is between <body>
and </body>
View 2 Replies
View Related
Oct 13, 2009
ok heres a regex
/^(?=.*d)(?=.*[A-Z])(?=.*[a-z]).{8,16}$/
which checks I have at least one lowercase letter, one uppercase letter and one number and the string is between 8 and 16 characters.I have adapted this from another source and it works as intended on all browsers but not IE7 or IE6 (oh microsoft why do you make my life so hard)This works fine in all other browsers (IE8 is fine) but doesnt work in IE6 or IE7
View 1 Replies
View Related
Oct 23, 2005
I'm writing an ECMAScript tokeniser and parser and trying to find out if I can eliminate the switching from tokenising "/" as start of regex or the division operator depending on the parser feedback - essentially, if I can make the tokeniser independent of the parser. (I have a gut feeling this needs too much special casing to be worth it). Code:
View 2 Replies
View Related
Jun 27, 2010
I have been playing with this regex for a few hours now I want to make it so it accepts commas also.
At the moment it works with A-z and - . ' but can't seem to figure out how to include commas.
View 4 Replies
View Related
Jun 21, 2011
I have a bunch of text that I want to split into an array of sentences. I have the following code that works just fine on FF and Chromium, but ofc has to fail on the pile of *** that is IE [code]...
It does not produce any errors, but the resulting array often has empty strings as value instead of the sentences that should be there. how to do this in a way it also works on IE?
View 1 Replies
View Related
Oct 27, 2004
i have the following regex:
(s*{s*(<?)s*(>?)s*}s*)
this needs to be able to match a string and make the following replacements:
if the string matches without < or >, replace the match with a space, a replacement string, and another space. if < matches also, do not add the left space. if > matches, do not add the right space. if < and > match, do not add the beginning or ending space
Old {} String => Old Replacement String
Old {<} String => OldReplacement String
Old {>} String => Old ReplacementString
Old {<>} String => OldReplacementString
this will have to be done a LOT of times, so efficiency is very important the answer in php is below. can anyone help me figure out how to do it in javascript? PHP Code:
View 4 Replies
View Related