Making Location.pathname.indexOf Not Case Sensitive?

Jul 6, 2011

I'm trying to figure out how to make this code not be case sensitive when it comes to the "default.asp" line. The code below in the head of a XHTML template and adds the CSS info only on the homepage, which is domain.com or domain.com/default.asp. It works just fine, but when I visit [URL].. it doesn't work. How do I make it case insensitive?

[Code]...

View 2 Replies


ADVERTISEMENT

Compare Two Arrays Without Considering Case Sensitive?

Oct 28, 2011

I would like to compare two arrays of characters...but the comparison should be case-insensitive i.e. A should match a...how can i do this?

View 1 Replies View Related

Removing Case Sensitive When Comparing Form Fields?

Jun 20, 2011

I'm trying to make my form both check that the e-mail's match and also be case insensitive when being submitted. I've figured out how to get the e-mail's to be checked to match, but can't figure out how to also make it not case sensitive.

This is what I have so far...

<head>
<script type = "text/javascript">
function checkSame() {
var emval1 = document.cform.email.value;

[Code]....

View 5 Replies View Related

Location.pathname.lastIndexOf

Aug 19, 2007

something like: location.pathname.indexOf

I want to check if there in the path is a folder named 'travel'

tried this:

if (location.pathname.indexOf('travel')) zlang = 1; ....

View 2 Replies View Related

Parsing Out Basename From Location.pathname?

May 9, 2006

I can do this easily in PHP but how can I get just the filename (with no extension or domain) in Javascript.

alert(location.pathname);

Will return: "etc/etc/etc/bobs_page.html"

But I only want "bobs_page" read into my variable. Does javascript have an equivilant to getBaseName?

View 3 Replies View Related

Highlight Navigation Using Location - Pathname

Jan 10, 2010

I'm attempting to get a nav system in place that will highlight the current nav item based on full path. The <li> of the menu item matching the current page should have the class "selected" attached to it. I'm just having zero joy and I've been at it all weekend.

[Code]...

View 2 Replies View Related

Making Expanding Menu Hierarchy Sensitive?

Mar 17, 2010

I'll get to the hierarchy sensitive part next, but for now I need help making this even work with two top-level links. I'm building a left-navigation that's expandable. Click a little + box image to the left of a top-level section's link, and all the links to sub-sections within that section expand out, the + box image becomes a - box image, and clicking the - box collapses the sub menu links. The scripts below work so long as I just have one top-level section, but because they us an ID for the +-box image, when I add a second top-level menu item, the swapImage function no longer works. How do I make it work with a class instead of an ID? The JavaScript and HTML code is below:

[Code]...

View 2 Replies View Related

Using A Function To Create A "Case IN-SENSITIVE" Search?

Nov 9, 2010

I am a beginner in programming however I am close to completing this task for my uni course and I know what method is needed "toLowerCase()" yet I am not sure on where it needs to be placed. :confused: If i paste in the question and then the coding I have done so far to discover if string s appears in any of the URLs in the array pages. Gives an alert of s together with 'found' or 'not found' as for find1C. [Note that the search should be case insensitive so that 'lboro' and 'Lboro' and 'LBORO' would all be found in [URL]... all remaining functions should also be case insensitive in this way]

[Code]...

View 3 Replies View Related

"Case Sensitive"

Jul 23, 2005

This script is designed to remove foul language from a document, the
question is that it will only remove what is put into the array, these
words are in lowercase, now how can I have the script parse the document
in lowercase?

If foul words start with a cap or their in uppercase the script won't
remove them.

I tried putting .toLowerCase(); into different parts of the script and
it powered me off a few times.

View 5 Replies View Related

Use String.replace That Is Not Case Sensitive And Replace Every String Found?

Jul 27, 2010

Here is my code:

<script type="text/javascript">
var str="Welcome to Microsoft! Microsoft Microsoft";
var stringToBeFound = 'Microsoft'
var ReplaceString = 'site'
document.write(str.replace(stringToBeFound , ReplaceString ));
</script>

My problem is im trying to use string.replace that is not case sensitive and replace every string found. I could use regular expression with it but my stringToBeFound is a dynamic variable im getting it from my database

View 9 Replies View Related

Making Document.write Write Into A Specific Location ?

Mar 24, 2011

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?

View 1 Replies View Related

Using Indexof To Find A Quote

Jul 23, 2005

how can i use the .indexof function to check if there is a quote in the string. i can't seem to find the correct syntax for do this without an error occuring

View 6 Replies View Related

Delete A Certain String Using IndexOf()?

Jul 18, 2010

I have been creating a little Javascript game. People buy items and then sell them for a profit. WHen someone buys something, it displays an image of the thing they just purchased (and have previously purchased). I want them to be able to "sell" the item by clicking on the picture. I have the money system set up, but I'm not sure about how to get rid of the picture when the user clicks on it. Is there anyway to get rid of a certain string (<img src="BLAH" class="BLAH">) when clicked on? I'm pretty sure you can use indexOf() somehow to do this, but I'm not exactly sure how

View 4 Replies View Related

IndexOf() Not Registering With Certain Code Blocks?

Oct 30, 2009

my indexof() function is not being recognized when I enter an email address for an unsubscribe form I have on one of my pages. Additionally, the confirmation message is also not showing up when the email address IS valid. Here is my code that I am using on a PHP page:function Unsubscribe() {

var IsValid = document.getElementById("email").value;
alert(IsValid.indexOf("@"));
exit;

[code]....

to those PHP experts, I am aware of the RegEx function for validation, but I don't understand it, which is why I don't use it (in case anyone points that out).The other thing that is problematic is that the PHP code is automatically using HEADER() regardless of "email"'s value

View 7 Replies View Related

Array Declaration Is Adding IndexOf

Oct 13, 2009

I'm creating matrix of values like this:[code]Usually when i want to access position like Matriz[0][0] y retrived the value "", now for some reason when i debug appears "indexOf" at the beggining and when I access Matriz[0][0] I get "undefined".Someone knows why is happennig this, i'm using IE 6

View 2 Replies View Related

IndexOf - Leap Year In Date Picker

Jan 7, 2012

If you see my last post, it was a piece of this code that I was learning for/loops but now I have that all working(hence the new topic) and I'm having a problem with indexOf. Here's the whole script(its a fun little date picker)

function popSel(v){
var days;
var x;
if(v==01 || v==03 || v==05 || v==07 || v==08 || v==10 || v==12){
x = 31;
}else if(v==04 || v==06 || v==09 || v==12){
x = 30;
}else if(v==02){
/*var yr=document.getElementById("year").value / 4;*/
var yr = 2003 / 4;
if(yr.indexOf(".") == -1){ /*If you divide a year by 4 and the value is a whole number, it's a leap year*/
x=28;
}else{
x=29;
}}for(i = 1; i <= x; i++){
days += "<option value=" + i + ">" + i + "</option>";
}document.getElementById("day").innerHTML=days;
}
The whole script works but feb doesn't change?

View 5 Replies View Related

Form Delay And Redirect / Sensitive Field?

Jan 30, 2009

Ive created an asp based sign on page with codebehind. Basically how it works is when the submit button is clicked, it triggers an event which captures the values the user has entered, writes out a new form and passes these values to the appropriate fields in the form, and finally I have javascript which automatically submits the form. It works, but i have a few issues..

[Code]....

Also, the other issue...If I comment out the auto submit javascript and log in (it then writes out the form waiting for me to submit before moving to secure side) I can view the html source and actually see the values entered into the field. Of course, with the javascript not commented out the form submits as soon as it is written out so the user never sees it, but I'm thinking this could still be a security risk? Can I make these values invisible somehow?

View 1 Replies View Related

JQuery :: Plugin To Display Date Sensitive TEXT?

Jun 25, 2010

I have a "poem of the week " page- I would like a plug in which checks the date on page load, then goes and gets the TEXT (the poem) for that week and displays it in the indicated div. Would be good if it has a place to store the snippets of text (poems) for one year- so 52 snippets of text.

View 12 Replies View Related

Get Full File Pathname In Google Chrome Using Input Type "file"?

Dec 2, 2011

Am developing a form in which user image should be viewed and stored in web database. I am using html5 and javascript. While using input type= "file" to browse the image, chrome shows the file path as c:/fakepath/*.jpg.

How can I get the full path name in google chrome to display image and to store it in web database.

If you have some other options to display and store the image in web database using javascript and html5

View 12 Replies View Related

JQuery :: $.url() Function - Being Utilized For Parsing Out The Window.location Or Window.location.search Parameters

Feb 14, 2010

Danged if I can find the thread, but I swear I saw a $.url() reference in here a day or two ago. It was beingutilized for parsing out the window.location or window.location.search parameters. I made a mental note because that was something I would be needing to do.

Now I can't find it, either because the search isn't finding it or I was dreaming about this function existing.

I rummaged about the API docs and didn't find it there either. Is it something provided by one of the plugins and not a function native to jQuery?

View 3 Replies View Related

Shell-like Case

Feb 20, 2007

In Bourne shell, you can do:

case ($x) in
foo*)
;;
*bar)
;;
esac

so that the first case matches any string starting with "foo", the
second any string ending in "bar", etc. In Tcl, you can:

switch -glob $x {
"foo*" {
}
"*bar" {
}
}

and accomplish the same thing. I'm struggling to do that in
JavaScript. switch seems to follow C semantics and do a full-length
match. And String.match() doesn't seem to do glob-style matching so I
can't do:

if ($x.match("foo*")) {
...

Is there a way to match on patterns in a JavaScript control structure?

View 7 Replies View Related

Case Statements In Javascript

Apr 16, 2007

So I have some code like:

if (document.Insurance.State.selectedIndex == 1)
{
ifIll();
}
else if (document.Insurance.State.selectedIndex == 2)
{
elseKan();
}
else if (document.Insurance.State.selectedIndex == 3)
{
elseInd();
}

I am trying to replace the if-else statements with case statement as
follows:

var index = document.Insurance.State.selectedIndex;

switch (index)
{
case 1:
ifIll()
break
case 2:
elseKan()
break
case 3: elseInd()
break
}

This code doesn't work ! Am I missing something here?

View 17 Replies View Related

Case-Sensitivity Of GetElementsByTagName

Feb 1, 2004

I'm working on developing an RSS/RDF/Atom Parser in JavaScript. I've already successfully implemented complete support for RSS 0.9x and 2.0. So far, so good. However, I've run into two minor problems. One is mentioned here, and one is in another post.

The issue that I'm coming across is the case-sensitivity of getElementsByTagName() when parsing standard RSS (XML) tags.

Danny Goodman's JavaScript Bible says that the tag name string that gets passed as the parameter in getElementsByTagName() is case-insensitive. However, this is speaking in terms of HTML and the HTML DOM. I'm working with XML, and getElementsByTagName is handling the XML tags as being case-sensitive.

Can someone suggest a way around this? Can a regular expression be used as the parameter? If so, what would the syntax be (as I'm not very familiar with regex)? For example, I want a <textinput> tag to be handled the same as <textInput> (which is the correct syntax).

View 11 Replies View Related

Javascript Case Statement

Mar 3, 2006

I am writing some javascript code and just wanted to check if a case statement could have OR / AND. If yes, what would the syntax be like.

What I need is this:

switch (country) {

case "US" || "Canada":
//do something
break;
case "Australia" || "UK":
//do something
break;
}

I can alternatively use IF statement but was curious.

View 2 Replies View Related

Conditionals In Switch 'case' Labels

Jul 20, 2005

Is this sort of thing possible:

var X = 'Moe'
switch (X) {
case 'Curly'||'Moe'||'Larry':
alert('Found one of the Three Stooges');
case 'Chico'||'Harpo'||'Zeppo'||'Grouco'||'Gummo':
alert('Found one of the Marx Brothers');
default:
alert('No matches');

This gives 'No matches' unless I only put a single string in the 'case'
lines. I've just been using VB's Select Case which is a similar flow
control but which allows conditional arguments in the 'cases'. I just
wondered...

I realise you could put each set of names in an array and iterate
through each array, but that's a different issue.

View 4 Replies View Related

Document CreateElement Changing Case Of Tag?

Jul 21, 2009

I'm experimenting with creating SVG dynamically and am finding that document.createElement is changing the case of the tags I input. This is breaking because, apparently SVG tags are case sensitive. For example, when I try to create a linear gradient element like so:var grad = document.createElement('linearGradient');what appears in the view source is:<lineargradient ...> (Note the lowercase "g")The tag doesn't work if the "G" is lowercase. Is there any way to specify in the <html> tag (or somewhere else) that the document should preserve tag case?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved