If I have the following variable which contains the drop down menu for list of card numebrs:
var abc='<option value="1234567890123456">1234567890123456</option><option value="0987654321987654">0987654321987654</option><option value="0147852369014785">0147852369014785</option>'
How can I pass this variable to a function and mask only the dispalyed card number? i.e. to have the following result:
Note: the number of options in the drop down menu may varry, in this example its only 3 options, it might be more or less, this is why I called it "Smart Substring".
I am trying to write a regex that will parse BBcode into HTML using JavaScript. Everything was going smoothly using the string class replace() operator with regex's until I got to the list tag. Implementing the list tag itself was fairly easy. What was not was trying to handle the list items. For some reason, in BBcode, they didn't bother defining an end tag for a list item. I guess that they designed it with bad old HTML 3.2 in mind where you could make a list by using:
<ul> <li>item 1 <li>item2 </ul>
However, I need to make this XHTML compliant, so I needed to add the </li> tag into the mix. Unfortunately, the only way to find where to put it is to find the next[*] (<li>) tag or an open list (in the case of nested lists) or close list tag. I was trying to get a rule that handles the list items to work, but it only matches the first item in any list. Here is the line of code:
First, I check to make sure that the list item is inside a list. Then, I match the[*] tag to find the start of the item, then I match either the next[*],, orto determine the end of the item. This successfully prevents a list item outside of a list from being made into a <li> element, but only matches the first list item in a list. Is there any way to make this match all occurances of this pattern without looping over the statement until the pattern can no longer be found?
I'm fooling around with building a form that grows depending on the users input (relatively new to DOM 2 - but fun stuff!) I'm working on getting it to work (rather than being pretty - there are many improvements that could be made).
My question is has anyone seen any similar examples out there? The more I build on this thing, the more I believe there has to be another way... (like rather than creating every pull-down box - yes, I should put that into it's own function! - should I be playing with visibility and positioning?) Code:
I have an application where I have 9 items to choose from and desire a table that will allow only 3 items (any 3 items) to be chosen then check out of the table.Check out can not be allowed unless only 3 items are selected.
Is the JScript applications somewhere that will perform this logic?
I have an autosave feature that, well... autosaves every minute. Now I could very well become the biggest abuser of my own feature. I currently have 8 windows open - I tend to just leave windows open for a long time. As a result, the javascript would be running every minute saving, creating unnecessary load on the server.
How could I make the autosave smart and only save if they are actively "working" with it? The only thing I can really think of is to have like a variable that sets to true whenever something happens, set to false whenever it saves, and only save when the var is true. Problem is, I have a lot of functions for events that I would need to attach it to... I'm sure I would miss it somewhere.
I'm using this rich text editor. Whenever a user pastes rich text from a program like Microsoft Word, the program's smart quotes are not understood by the browser (they appear as a diamond with a question mark in it). I ran a php function on the post value to replace all quotes with ascii characters, but realized that it also replaces the quotes present in the html generated by the javascript.Is there a way to convert smart quotes to normal quotes without also tampering with the html content?
How can I write javascript codes to interact with a smart card reader? I have found some activex controls and examples, but I think, it will be limited to IE only.How can I make it run in all browsers, if the card reader driver is installed, and the hardware is available for use?My problem is to make sure that the user puts his/her own smart card in the reader unit before he signs up in a website (a particular website, that I will be coding for).
I have URLs as follows. [URL] I need a function which can retrieve substring from the above URLs. The substring should be upto the 2nd occurence of '/' as follows. [URL]
I have a validation script for upc codes which is currently working for values that are entered into one text box. I've been asked to break up the text box into 3 separate fields to accept the 1st digit, middle 10 digits, then last check digit. What I'm doing is substringing the initial values then concatenating them. What I'm not sure of is, how to handle the validation. I was previously firing an onBlur after the text box but now that I have three, and I need the values to concatenate into one for the validation. Should I just fire a function after the 3rd field that concatenates the 3 values, then pass that value to the validation function? Or is there a better way?
I was also wondering if there was something I could find like an input mask, but something that could just "overlay" on top of a regular text box with one value which could give the appearance of having separations for certain digits, in this case the first and last.
I am trying to take a form input field and take what was entered and grab the first 8 character of what was entered and then submit that to a form instead of what was entered.
I am looking for a function that will replace last occurence of a substring from a string: tmpStr: xxx, yyy, zzz, sss, The desired outcome: xxx, yyy, zzz and sss (ie: remove last letter and then replace last occurrence of ",") The string can differ,
* xxx, * xxx, yyy, * xxx, yyy, zzz,
Do anyone of you have a neat fuction for that? I will be so happy for all input!
I'm trying to read the substring of a url so when the page loads up, it would know if it needs toimmediatelyjump to another tab.So a user clicks a link like this:[URL] On that page, there are already functions listening for click events on objects with a class names like "gotoTab2".So all I really need is for jquery to check if there's a '#something' in the url when the page loads up, and if so execute a 'click' on that substring as if it was a class.
I have been able to use javascript to place the last modified date in the bottom left corner of my document however I do not need the time with it. How do I use the substring() method on the lastModified property? Here is what it looks like.
<script type="text/javascript"> <!--Hide from old browsers var today = new Date() var dayofweek = today.toLocaleString() dayLocate = dayofweek.indexOf(",") weekDay = dayofweek.substring(0, dayLocate) newDay = dayofweek.substring() [Code]..
I'm trying to get the value of an input box after a delete key has been pressed at a certain position. For example: If I have: afghanistan and my caret is at position 4 and I push delete I will be left with: afghnistan I'm able to determine the caret position and detect the delete key and then I am trying to use slice to return the new value of the string like: Code: value.slice(caretPosition,caretPosition+1) This returns the value of what was sliced out of the string - how can I modify the parameters of slice to return everything BUT the removed part?
I have created a similar smart search like yellowpages:[URL]... Here is the problem I have with mine:
Lets say I search 'Attorneys' I start typing 'Att' ... then 'Attorneys' shows up in the smart search so I click on it and press enter. The next time I start typing 'Att' my browsers saved search field pops up over the websites smart search. Here is an image which might help explain the problem a bit more:
I found this code online. It detects if vertical scrollbars are present in your browser, and if so, it adds a link to the top of the page at the bottom of the open page.
The only thing is, it prints the link in the bottom left corner of the screen, and I really need it to show up in a specific area. Does anyone know of a similar script I can use for that? I want one that will only show up if the page has vertical scrollbars. Code:
I need help with substring or trim function in javascript. Find below my code. Selection holds the value Select State, and length of the string is 14. I need to equate the Selection value to string "Select State" and execute alert message.
function selected_item() { if (Selection=="Select State") alert("Select the State");[code]....
I tried this:
var state=Selection.substring(0,11); and then string would be equated to state variable. But it is not working.