/    Sign up×
Community /Pin to ProfileBookmark

Help w/ script in form- click vs. enter key

Hi everyone,
I’m having a little problem with part of my site. I really know nothing about javascript, just enough to get the site working in the first place.

Here is the page with the problem:

[url]www.jeffludes.com/client_access_pc.html[/url]

Try putting “test” in the password box, and clicking the button. It works, right? Now do it again, but use the enter key rather than clicking. No workie.

What gives? I feel like it just needs some command like onenterkeypress= : P

It would also be great if the cursor was in the password box when the page loads… But that’s just icing at this point!

Thanks for any help!
Jeff

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundrySep 07.2004 — Welcome to the forums.

Neither the table-based layout nor JavaScript "password protection" are good ideas. If you want security and usability/accessibilty, you will need to use a server-side language.

If not, call Guardian() from the form's onsubmit event handler instead of the onclick event of the button.

Adam
Copy linkTweet thisAlerts:
@ludesjauthorSep 07.2004 — Hey Adam,

Thanks for the reply. Yes, I'm aware of the issues with javascript passwords. But I think this script is pretty good, because it's not really a password, it's just the name of the folder I give the user. So you'd have to know the name to get in. And this isn't super top-secret stuff anyway, so it works for me. Or perhaps I need to be educated- is there a way for people to get a directory listing of my site?

As to your other suggestion, yes, I tried calling the script on the form's onsubmit, but nothing happens. When clicking or hitting enter, the page just reloads. Am I doing something wrong?

Thanks again,

Jeff
Copy linkTweet thisAlerts:
@AdamGundrySep 08.2004 — Try adding a "return false" instruction after Guardian() in the form's onsubmit event handler, and change the type of the button to "submit".

Adam
Copy linkTweet thisAlerts:
@ludesjauthorSep 09.2004 — Thanks for the idea, Adam. That's the kind of specifics I need! I'll give it a shot when I have a chance, and report back.

Jeff
Copy linkTweet thisAlerts:
@ludesjauthorSep 09.2004 — Yeah! It works! Yep, adding the return false did it. Of course, the other problem is that for some reason, my GoLive kept referring to the script library burried deep in my hard drive, and I guess the web browser needs it in the same directory as the page itself. Whatever, it works =)

Now I just need a little something to set the focus to the password field... A battle for another day.

Thanks again for the help, Adam!

Jeff
×

Success!

Help @ludesj 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.18,
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,
)...