/    Sign up×
Community /Pin to ProfileBookmark

Problem with get length ?

? Help?
i want make change to url = [url]http://amazon.com/asdd/di/B000345/—[/url]
i want get the B000345 with length.
how can i check for length, i check for amazon.com , but scriptis not work on check the length 7(B000345)
check the attachments

function parseLink() {
var url = document.addForm.linkurl.value.toLowerCase();
if ( url.indexOf(“amazon”) != -1 ) {
var aIndex = 0;
var merchlist = document.addForm.merchant;
for (i=0; i< merchlist.length; i++) {
if (merchlist.options[i].text.toLowerCase() == “amazon”) {
aIndex = i;
}
}
document.addForm.merchant.selectedIndex = aIndex;
var output = “”;
var temp = new Array();
temp = url.split(“/”);
document.addForm.remoteid.value = temp[5];
}
}
</script>

[upl-file uuid=86076177-e23d-4d63-afc8-d68fc334eb38 size=10kB]Image3.jpg[/upl-file]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 18.2005 — temp[5].length
Copy linkTweet thisAlerts:
@desijattauthorOct 18.2005 — i want use the by length, not want use temp = url.split("/");, how can i use that length, i want check for lenght of the B000--
Copy linkTweet thisAlerts:
@konithomimoOct 18.2005 — set it to a string and use .length

for instance, if you have the textbox as

<input type="text" name="text1" id="text1" value="". . . >

then use:

var mystring = document.getElementById('text1').value;

var mylength = mystring.length();

then mylength will have the number that you want.
×

Success!

Help @desijatt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.22,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...