Home > front end >  How to implement page automatically and every three seconds refresh once. Each time to refresh the q
How to implement page automatically and every three seconds refresh once. Each time to refresh the q

Time:12-09

X768px want to used for the flow of information, web page can be placed in multiple static qr code, enter the web page after page will automatically refresh, refresh every, web pages within the qr code will change, can be achieved? Bosses

CodePudding user response:

Qr code, if you need to change to use QRCode. Js
 var QRCode=new QRCode (" test ", {
Text: "http://www. baidu. Com",
Width: 128,
Height: 128,
ColorDark: "# 000000",
ColorLight: "# FFFFFF",
CorrectLevel: QRCode. CorrectLevel. H
});
Qrcode. The clear ();//cleanup code
Qrcode. MakeCode (" http://www.w3cschool.cc ");//generate another qr code
as for the changes click trigger or timer delay timer trigger is controlled by yourself, triggered the callback when change the url,

CodePudding user response:

Satisfaction please "

CodePudding user response:

reference 1/f, ms side response:
qr code, if you need to change to use QRCode. Js
 var QRCode=new QRCode (" test ", {
Text: "http://www. baidu. Com",
Width: 128,
Height: 128,
ColorDark: "# 000000",
ColorLight: "# FFFFFF",
CorrectLevel: QRCode. CorrectLevel. H
});
Qrcode. The clear ();//cleanup code
Qrcode. MakeCode (" http://www.w3cschool.cc ");//generate another qr code
as for the changes click trigger or timer delay timer trigger is controlled by yourself, triggered the callback url, changed
how do you write the code o

CodePudding user response:

reference weixin_42133672 reply: 3/f
Quote: refer to 1st floor park side response:
qr code, if you need to change to use QRCode. Js
 var QRCode=new QRCode (" test ", {
Text: "http://www. baidu. Com",
Width: 128,
Height: 128,
ColorDark: "# 000000",
ColorLight: "# FFFFFF",
CorrectLevel: QRCode. CorrectLevel. H
});
Qrcode. The clear ();//cleanup code
Qrcode. MakeCode (" http://www.w3cschool.cc ");//generate another qr code
as for the changes click trigger or timer delay timer trigger is controlled by yourself, triggered the callback url, changed
how do you write the code o
would you js, will directly to QRCode. Js's official website to find the introduction of the js method, and then write a delay timer, which is what you say every few seconds time, content is my last comment code,

CodePudding user response:

https://github.com/davidshimjs/qrcodejs the git repository with use cases

CodePudding user response:

Are you sure are a page refresh, not data changes==if once every three seconds, the user experience and it==speed slow down in three seconds hasn't come in, you refresh again

CodePudding user response:

Introduction: if you just HTML page they provide into the inside of the git qr, js is ok, if is a framework to NPM install qrcodejs2 download dependencies
Then your requirements into the web page, refresh automatically;

/* ** is suitable for the request type qr code of the background, the background of the request url is simpler, request once every 3 seconds, after successful request to remove a qr code, get the url for the assignment can 
*/
Var urlList=[' url1 ', 'url2', 'url3', 'url4];//do you want to change the url real-time summary
var index=0;//the default first
Var qrcode=new qrcode (" test ", {
Text: urlList [index],
Width: 128,
Height: 128,
ColorDark: "# 000000",
ColorLight: "# FFFFFF",
CorrectLevel: QRCode. CorrectLevel. H
});
SetInterval (function () {
index++;
Qrcode. The clear ();//cleanup code
Qrcode. MakeCode (urlList [index]);//generate another qr code
}, 3000)//once every 3 seconds

CodePudding user response:

Correct once, and then just qr code of the page refresh every few seconds at a time, a page refresh certainly unreasonable, which have watch you brush him,

/* ** is suitable for the request type qr code of the background, the background of the request url is simpler, request once every 3 seconds, after successful request to remove a qr code, get the url for the assignment can 
*/
Var urlList=[' url1 ', 'url2', 'url3', 'url4];//do you want to change the url real-time summary
var index=0;//the default first
Var qrcode=new qrcode (" test ", {
Text: urlList [index],
Width: 128,
Height: 128,
ColorDark: "# 000000",
ColorLight: "# FFFFFF",
CorrectLevel: QRCode. CorrectLevel. H
});
SetInterval (function () {
index++;
If (index==4) {
The index=0
}
Qrcode. The clear ();//cleanup code
Qrcode. MakeCode (urlList [index]);//generate another qr code
}, 3000)//once every 3 seconds

CodePudding user response:

Is your static qr code qrcode generated, if not qrcode generated, is a figure, just a simple shuffling figure can also; Only three seconds to change figure

CodePudding user response:

refer to the second floor park side response:
satisfied please "
although not only in your way, but how to" post

CodePudding user response:

Hello, if I want to do and code switching different qr code? This can be achieved

CodePudding user response:

The timer can be three seconds, but in this case, the role of the qr code, there is no ah, you might look at the three seconds, there will be no
  • Related