/    Sign up×
Community /Pin to ProfileBookmark

Pls help me interpret this script.

Hi All,

I am able to overcome this kind of script on my studies. Hope u can help me interpret it:

The code is as follows:

[CODE]
<form name=”a” action=”javascript:b()”>
<input type=”password” name=”c” maxlength=”20″ size=”14″>
<p><input type=”submit” value=” login “>

</i></center></noscript>

<script language=JavaScript>
function b(){document.location.href=”http://academy.dyndns.org/nine/”+document.a.c.value+”.htm”;
}
</script>

[/CODE]

I am new with javascript but trying to learn it though.

Any help will be greately valued.

–david

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@huebiSep 03.2004 — You mean tell you what it does?
Copy linkTweet thisAlerts:
@javaNoobieSep 03.2004 — simply redirects you to whatever page you have entered in the password field upon submission of form.

eg.if you typed 'whatever', it will redirect to http://academy.dyndns.org/nine/whatever.htm. if you typed 'somepage', it will redirect to http://academy.dyndns.org/nine/somepage.htm
Copy linkTweet thisAlerts:
@Hum4nauthorSep 03.2004 — [i]Originally posted by huebi [/i]

[B]You mean tell you what it does? [/B][/QUOTE]


Yes Pls. Line by line if possible.

TIA
Copy linkTweet thisAlerts:
@javaNoobieSep 03.2004 — [b]

<form name="a" action="java script:b()">

[/b]
[/quote]

a form by the name of 'a'. action refers to the page where the form is to be submitted. in this case upon submission, form will call a js function called 'b'
[b]<input type="password" name="c" maxlength="20" size="14">[/b][/quote]
textbox of name 'c', type='password' means whatever is typed inside will be masked, maxlength refers to the max number of chars you can type, size refers to the size of the textbox
[b]<p><input type="submit" value=" login ">[/b][/quote]
button when clicked submits the form.
[b]</i></center></noscript>[/b][/quote]
nothing related to the script. Just closing tags.
[b]<script language=JavaScript>[/b][/quote]
opening script tag to hold the script
[b]function b()[/b][/quote]
creation of a function called 'b'
[b]{document.location.href="http://academy.dyndns.org/nine/"+document.a.c.value+".htm";[/b][/quote]
does redirecting. in this case it will redirect to http://academy.dyndns.org/nine/<document.a.c.value>.htm. document.a.c.value refers to the textbox name 'c' in the form by the name of 'a'
[b] }[/b][/quote]
closing brace for the function
[b]</script>[/b][/quote]
closing script tag
Copy linkTweet thisAlerts:
@huebiSep 03.2004 — Doh, I was just about to submit my post but JavaNoobi beat me to it.

happy coding
Copy linkTweet thisAlerts:
@Hum4nauthorSep 03.2004 — wow! :shock: you've been very helpful!!!

Thanks and more power!
Copy linkTweet thisAlerts:
@KorSep 03.2004 — Mybe it would have been a better ideea to use [b]onsubmit[/b] as an event handler and [b]action[/b] as attribute:

<form name="a" action="" onsubmit="b(this)")>

<input type="password" name="c" maxlength="20" size="14">

<p><input type="submit" value=" login ">

and

<script type="text/javascript">

function b(f){

f.action='http://academy.dyndns.org/nine/'+f.c.value+'.htm';

}

</script>
×

Success!

Help @Hum4n 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.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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