1+ < html >
2+ < head >
3+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
4+ < title > Register</ title >
5+ </ head >
6+ < body >
7+ < center >
8+ < br > < br > < br >
9+ < h2 > BlackRoad </ h2 >
10+ < h3 > Account Update</ h3 >
11+ < br > < br >
12+ < label > User Name</ label > < br > < br >
13+ < input type ="text " id ="ux " placeholder ="Username "> < br > < br >
14+ < label > password</ label > < br > < br >
15+ < input type ="text " id ="px " placeholder ="Password "> < br > < br >
16+ < button onclick ="r() "> Update </ button >
17+ </ center >
18+ < script >
19+
20+
21+
22+ function getVal1 ( ) {
23+ const r = indexedDB . open ( 'black' ) ;
24+ r . onerror = ( ) => console . error ( 'oeror' ) ;
25+ r . onsuccess = ( ) => {
26+ const d = r . result ;
27+ const t = d . transaction ( 'sst' , 'readwrite' ) ;
28+ const s = t . objectStore ( 'sst' ) ;
29+ const g = s . get ( 'user' ) ;
30+ g . onerror = ( ) => console . error ( 'geerror' ) ;
31+ g . onsuccess = ( ) => {
32+ let mh = JSON . parse ( JSON . stringify ( g . result ) ) ;
33+ document . getElementById ( "ux" ) . value = mh [ "u" ] ;
34+ document . getElementById ( "px" ) . value = mh [ "p" ] ;
35+
36+ } ;
37+ } ;
38+ }
39+
40+ getVal1 ( ) ;
41+
42+
43+
44+ function c ( u , p , r ) {
45+ const d = indexedDB . open ( "black" , 2 ) ;
46+ d . onupgradeneeded = e => {
47+ const db = e . target . result ;
48+ if ( ! db . objectStoreNames . contains ( "sst" ) ) {
49+ db . createObjectStore ( "sst" ) ;
50+ }
51+ } ;
52+ d . onsuccess = e => {
53+ const db = e . target . result ;
54+ const t = db . transaction ( "sst" , "readwrite" ) ;
55+ const s = t . objectStore ( "sst" ) ;
56+ const o = { u, p } ;
57+ const a = s . put ( o , "user" ) ;
58+ a . onsuccess = function ( ) {
59+ alert ( "Black Road Account Updated Sucessfulll" ) ;
60+ window . location . href = r ;
61+ } ;
62+ a . onerror = ( ) => console . error ( "Error:" , a . error ) ;
63+ } ;
64+ d . onerror = e => console . error ( "DB Error:" , e . target . error ) ;
65+ }
66+
67+ function r ( ) {
68+ const u = document . getElementById ( "ux" ) . value ;
69+ const p = document . getElementById ( "px" ) . value ;
70+ if ( u == "" | p == "" ) {
71+ alert ( "Enter Valuese" ) ;
72+ } else {
73+ c ( u , p , "finpulse.html" ) ;
74+ }
75+ }
76+ </ script >
77+ </ body >
78+ </ html >
0 commit comments