1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

javascript - login & table scroll

Discussion in 'Programming' started by lew ashby, May 23, 2019.

  1. #1
    I was going to try and solve this with a CMD Python program using the requests library but I'm running into problems, can I solve this with JS? Thanks.

    connect to URL
    ask user to enter username and store in username-variable
    ask user to enter password and store in password-variable

    input data from username-variable into username field:
    <input id="inptUserId" maxlength="8"
    name="txt_inptUserId" onkeyup="autoSkipNN(event.which,this);" onfocus="saveFocusedControl("inptUserId");" tabindex="26"
    title="" type="text" value="">

    input data from password-variable into password field:
    <input id="password" maxlength="8"
    name="txt_password" onkeyup="autoSkipNN(event.which,this);" onfocus="saveFocusedControl("password");" tabindex="28"
    title="" type="password" value="">

    Click Button:
    <input alt="Enter" id="btnOK"
    name="btn_btnOK" onfocus="saveFocusedControl("btnOK");" tabindex="-1" title="" type="submit" value="Enter">
    lew ashby, May 23, 2019 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Uhm, what the blazes makes you think you need -- or even should use -- JavaScript for ANY of this?!? The LAST think you need here is any form of realtimes scripted nonsense, much less storing it in scripting making XSS even easier.

    If you have a login form, make a login <form> and let the ACTION do all the work.

    Beside that, anything or anyone telling you to use the outmoded possibly insecure onevent attributes in your markup is unqualified to tell you how to use JavaScript.

    ... and what's with the goofy names? Why would you limit usernames and passwords to a low security 8 characters?

    Honestly this looks like you don't know enough HTML to be writing JS yet or knowing when JS is appropriate to use or not.

    <form action="login.php" method="post" id="login">
    		<label for="login_name">Username:</label>
    		<input type="text" id="login_name" name="username" maxlength="64" required>
    		<label for="login_pass">Password:</label>
    		<input type="text" id="login_pass" name="password" maxlength="64" required>
    Code (markup):
    Would be the proper semantic accessible markup for a login form. If you REALLY want to enhance it with scripting, the scripting should hook that markup not be derped in with onevent attributes. If you want to validate it with scripting -- something stupid/wasteful in the age of HTML 5 attributes -- then you hook the "submit" event on the form. Otherwise, let it submit server-side and do it's job without JS pissing on usability and accessibility.

    The unwritten rule of JavaScript: If you cannot make a fully working page without JavaScript first, you likely have zero business adding scripting to it.. To that end, you should write as much of your page as possible to work without scripting FIRST, then use scripting to enhance the working user experience.
    deathshadow, May 24, 2019 IP
  3. lew ashby

    lew ashby Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    This is for logging into a pre existing site. Currently at my workplace we have to run a report once a week that is very time consuming and tedious, we have to log in, click an acknowledge button, make a dropdown selection and another click before finally getting to the page we need. Once there there is a table with 11 rows and an up and down button. One particular column in this table will either have a 'c' or an 's' and there are many pages to scroll through before getting to the end of the table, each page loading 11 rows, and we need the total count of Cs, and Ss. I'm trying to automate the process and create a 2nd front end that sends the user inputed credentials into the correct fields at the correct webpage and automates the process by automatically scrolling through all the pages of the table and counting up the Cs and Ss and spitting out the final count at the end. I'm having trouble with python on this project so I thought JS might be a solution. The original form is already built, I'm just wanting to create a 2nd form for entering our login data and getting our final C & S count.
    lew ashby, May 24, 2019 IP
  4. Web_Dev_Chris

    Web_Dev_Chris Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    A task like this is very easy to do in JavaScript.

    Web_Dev_Chris, Jun 10, 2019 IP