Wecouldjustgiveit a simpletitleofpasswordgeneratorandthenalso, we'regonnaneedtohavetootherfiles.
We'regonnahave a jobscriptfile, sothat's goingtobeinsideof a scripttag.
Andwe'rejustgonnacallthisscriptdotJsandmakesureyoudeferthissothatitloadsafterthebodyofyourHTMLandthenwe'realsogoingtoneed a linktagandthisisgoingtobeforourCSScallitstylesthatCSS.
Andnowthatwehavethatdone, thefirstthingwecanworkonisourHTMLandtogetstarted, theveryfirstthing I wanttocreateis a containerwhichisgoingtocontainthisblueboxoftheblackborder.
Sowecouldjustcreate a containerdivhereandinsideofhereisgoingtobeovercode.
First, we'regonnahavethispasswordgeneratortitle, whichisjustgoingtobean H onetag.
Andinsideofit, we'rejustgonnaputpasswordgeneratorhopesgenerateorjustlikethatandthenalsounderneaththatwe'regoingtohavethissectionactuallycontainsaregeneratedpassword, andwe'regonnaputthatinsideofan H threeandfornow, we'lljustdefaultpassword.
Sowhatwe'regonnadoiswewanttomakesurewehave a heighthereoftwo R e m essentiallythatallowustofittworowsoftextandwealsowanttositinherewithwhichisjustgoingtobe 350 pixels.
We'lljustdoone r e m, whichisgoingtoroundourcornersallthewayaround.
Now, thelastthingyouwanttoadd a hoverstatetothisandinsideof a huggerstate, allwe'regonnadoischangethebackgroundcolor, andwewanttomakeourbackgroundjust a slightlytransparentwhitecolor.
Thatwaywecangetourbluetoshinethrough.
Sowe'lljustsaysixchefs, whichisgoingtobewhite, andthen 33 isgonnagiveus a mostlytransparentwaitasyoucanseewhenwehoverthatit's a mostlytransparentwaitwhichshowsupisthisnicelightbluecolorandthat's alloftheCSSforourform.
Ifwepassin 65 here, it's actuallygoingtogiveusanuppercase A.
Wepassedin 82 isgonnagiveusanuppercaseareandsoon.
Soifwecreate a listofallthecharactercodesthatwecanuse, thatwecouldjustwrite a simplefourloopandloopoverat a bunchoftimestocreateallofthecharactersofourpassword, andthatissomucheasierthanwritingoutanarraythatsays a andthenit's goingtohavebeinsideofitandsoonlikethis.
Thattakes a lotofwork, andit's notveryclean.
Sointhisway, we'regonnahave a muchcleanercodesetupbyjustusingthesenumbersinsteadofusinganarrayofstrings.
Andwecanactuallyuse a functiontogenerateourraceforussowecanjustsayRayherefromhightoolow, we'regonnapassitinthelowvalueandthehighvalue.
What's actuallyjustnamethisfromlowtohighmakes a littlebitmoresense.
Therewego.
Andinsideofhere, allweneedtodoiscreate a simplefourloopthat's goingtogofrom a variable I thatisequaltolow.
Andthat's 97 to 1 22 So, hesaid, 97 1 22 justlikethat.
Andnowwealreadyhave.
A lotofitcouldsetup.
Let's doournumbersaswell.
Thisis 48 57.
Solet's copythissayingnumbercharactercodes.
Andthatisgoingtobe, as I mentioned, hoops 48 2 57 Now, lastly, wehaveoursymbolcharactercodessymbol, andthisisgoingtobeslightlydifferentlybecausethey'reactuallyquite a fewgaps.
First, wehave 33 to 47 whichis a bunchofdifferentsymbols, sowecancomeinhere 33 to 47.
Butwewanttomakesurewecan.
Captainate a newarrayontothatbecausewealsowanttogetallthesevaluesfor 58 to 64thsowecansaytheexactsamethingallofthesearrays.
Butwhatisitfrom 58 to 64.
Wealsowanttogetthesevaluesfrom 91 to 96.
Somethingcandoanothercancapnation.
Andwewanttogetthearraysherefromthe 91 to 96.
Andthenlastly, wewanttogetthese 1 23 toe 1 26 Soagain, whatisgonnacaptaineight?
Thatonthisisgoingtobeanarrayfromlowtohighof 1 23 toe 1 26 Nowwehavealloverdifferentarraysofcharactercodes.
Wecansaywhat I equalzerowhen I islessthanourcharacteramounts, flipscharacteramount, andwejustwanttoaddoneeachtimethisisgoingtolookonceforeachcharacterandwe'regonnaneed a variable, whichisgoingtostoreallofourpasswords.
Soit's a passwordcarericcharactersthat's justgoingtobeanemptyarray.
Butinordertogetthatcharacter, wejustneedtoget a randomvaluefromourlistofcharactercodes, asyoucanseehere.
Sowecansayourcharacter, I wasgoingtobeequaltocharactercodesandwewanttoget a singleindexonwhatwe'regonnadoissay, math 0.4 ofMattThoughtrandom.
Andwhatwewanttodoiswewanttoget a randomnumber, andthenwewanttomultiplythatrandomnumbertimesourcharacteramount, andnowthiscodelooks a littlebitconfusing.
Butessentiallywhatit's doingisthisgettingin a randomnumberbetweenzeroandourcharacteramount, andthenit's makingsurethatit's animagerbydoingmathoutfloor, andthenit's goingtogiveusourcharactercodeSothisisactuallygoingtobe a charactercodehere.