Retrieve Substring From The Above URLs
Mar 8, 2011I 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]
View 2 RepliesI 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]
View 2 RepliesI 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]..
How do i find the value next to width= (500)
in:
'"../graphics/press/012.jpg" width=500 height=339'
what does that do?? and is there a javascript manual out there that I can look up function in?
View 8 Replies View RelatedI have the following string:
http://www.myurl.com/folderbit/moer.../sdaf/01354.jpg
and I want to extract the filename from it.
Do you know how to do this, if I don't know the exact names of the folders,
etc...
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:
<option value="1234567890123456">1234XXXXXXXX3456</option><option value="0987654321987654">0987XXXXXXXX7654</option><option value="0147852369014785">0147XXXXXXXX4785</option>
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'd like to globally replace a substring specified by a regular
expression with itself along with some additional characters.
example:
var oldString = 'asdf BRACKETTHISasdfsdf sd asdBRACKETTHISasdf asd'
var newString =
oldString.replace(/sw*BRACKETTHISw*/g, '<' + ?some expression that
accesses current match? + '>' )
And newString winds up as:
'asdf <BRACKETTHISasdfsdf> sd <asdBRACKETTHISasdf>
asd'
Is there a way to do this, or do I have to use other methods?
Trying to debug someone else's javascript code. There is a line that
looks like this:
req = req.substring(req.length-2, req.length);
From what I can gather in their comments, they want to capture the last two characters of the string "req".
I'm guessing that the above line won't do that, and they want to change it to
req = req.substring(req.length-1, 2);
In other words, the parameters are starting position, and length. Is that correct?
what will be the regular expression for this line:
Code JavaScript:
var id = $(this).attr("href").substring( $(this).attr("href").lastIndexOf('#'), $(this).attr("href").length);
Basically it gets the string after # in href attribute of clicked anchor tag.
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 would like to assign the substring of particular text to a javascript variable so that I can use the variable in an if statement.
View 3 Replies View RelatedI 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.
here is what I have. Form
<form id="form" name="myForm" action="https:websiteSubmittingto.com" method="POST">
<label>inputfield1</label><br/><input type="text" name="inputfield1" style="width:150px;"/><br/>
[Code].....
I have tried putting a onsubmit on the form tag but that got me no where.
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.
View 3 Replies View RelatedI'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?
View 6 Replies View RelatedDoing some forum searching, I found the following code:
<div id="someThing" style="display:block" >Put something here.</div>
<script type="text/javascript">
var nowUrl = location.href;
[Code]....
Apparently, this is for use of when you are modifying, for example, a PHP header or footer displayed on every page and you only want something to show up on particular pages. My issue is that I am trying to put something in the header of a Tumblr blog, and I only want it to show on the post pages.
The Tumblr main page format is: [URL]
The Tumblr post page format is: [URL]
Is there any code I can use to do this?
I am wondering, if there is a easy way (for a programmer, but non-javascript
programmer) to find out which new URL is requested from javascript. Code:
I'm working on a project that has a logout button, but (like most
things) it's kind of a hack. I'd really like the one logout window to
actually hit two logout URLs. I only need to display one window that
a person has logged out, but would like to end the session in both.
I'm thinking I could use something like Code:
I have a database of URls' anf my web app calculates the loadtime of all this url one at a time and stores it in database,the way i am doing this is executing a javascript on onload event of iframe ,i want to calculate the cpu utilization of the sites as well and store it in database and have no clue to do this ,i can execute a system command like top but i can seem how to execute it in javscript,
View 2 Replies View RelatedI have to send the variable ii on the url so i can show a form on the thickbox:
<a href="#?ii='.$resul[$i]['id_nota'].'&TB_inline&height=255&width=300&inlineId=hiddenContent" title="News" class="thickbox" >
[code]....
assist with how to modify a specific css value of an object? For example, I want to do over all children of "body", and see if they have any css attributes containing a url(xxxxx) part. If so, I would like to make some change to that url (replace it with something else).
View 3 Replies View RelatedIm trying to parse an XML file that has holds the URLs to about 10 images. However, all the tutorials I have followed do not seem to work. Ive been trying this for a few days now and I was hoping one of your jQuery gurus may see something I dont.
Here are my codes :
XML :
<?xml version="1.0" encoding="UTF-8"?>
<Images>
<image url="_work/_new/balloonsfocusxtraballoons.jpg"></image>
[Code]....
JS isn't my usual language, but I'm venturing out to write a Chrome extension. This extension basically just injects a script on a page, so it behaves just like any other JS.Anyway, the script finds specific URLs on a specific page, and changes them slightly. I'm using regex to find these URLs. I've got one working, but I need another, and I can't figure it out.The first is this:Also, my skills with regex are miserable, so if you know of any way to make this better, I'm all ears. This matches URLs like this:Now I'm trying to match URLs like this:[URL]If you know how to modify the original regex so that it'll match the second kind of URL (but not the first)
View 6 Replies View RelatedI have a function which has two URLs that need to be posted via php onto a database. I had them as individual functions and they work fine but ideally I would like them to be done in the same function. For example, like the following...
if (request !== null){
request.onreadystatechange = loginsuccess; //function to check RS=4 & Status = 200.
request.open("GET", urllogonsubmit, urlrecieveemail,true);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(null);
}
I want to run some 100 urls on chrome with out exiting and also with out any tabs i.e on same window it should load urls one after another. I have written a script which will load urls in inframe. But how can i do it to load from address bar.
[Code]...
Is it possible to create URLs from function call operators?
For example, I'm trying to program an onClick function which will load a
webpage in one frame and an image in another, based on the name of the
button which is being clicked. So clicking the button with name="help" will
open "webpages/help_page1.html" in one frame, and "images/help.jpg" in
another.
To do this I was hoping that the following would work, where the function
had been called by
function activate(buttonName) {
webpageURL="webpages/"+buttonName+"_page1.html"
imageURL="images/"+buttonName+".jpg"
parent.frame1.location.href=webpageURL
parent.frame2.picture.src=imageURL
}
But this doesn't work, because the browser (IE6) looks for
"webpages[object]_page1.html" and "images[object].jpg".