/    Sign up×
Community /Pin to ProfileBookmark

return no undefined items

?
Hi ,

I’m no programmer, so what if I don’t want to see the undefined fields in this passing values script?
link is;[URL]http://javascript.internet.com/forms/passing-values.html[/URL]
This is the returnscript on the next page.
<SCRIPT LANGUAGE=”JavaScript”><!– This script and many more are available free online at –><!– The JavaScript Source!! [url]http://javascript.internet.com[/url] –><!– Begin
function getParams() {
var idx = document.URL.indexOf(‘?’);
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split(‘&’);
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split(‘=’);
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
// End –></script>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@MarcauthorFeb 04.2003 — If a visitor doesn't fill in all fields the returnpage gives a lot of 'undefined' values.

I like to know if it is possible to filter out the nonfilled(so 'undefined') items and only show the filled in ones, by using the same script.

Friendly,

Marc
×

Success!

Help @Marc 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 6.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres
});

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: @Marika,
tipped: article
amount: 1000 SATS,

tipper: @hatem774,
tipped: article
amount: 1 SATS,

tipper: @nearjob,
tipped: article
amount: 1000 SATS,
)...