Hongmu Notes
Home Language Notes js click the button to pop up the query...the query results will be displayed after three seconds
Language Notes JavaScript

js click the button to pop up the query...the query results will be displayed after three seconds

js click the button to pop up the query...the query results will be displayed after three seconds

When the button is clicked, a pop-up window appears displaying "Querying payment status...". After three seconds, a message will appear stating "No payment bill found – please make the payment." This is the core logic; additional backend request code can be incorporated into this process, but it has been omitted here.

HTML code:

<button data-v-b863db80="" type="button" class="el-button btn-info el-button--button" style="margin-top: 2%;" onClick="">
<span>支付成功请点击.... </span>
</button>

js code:

function showPaymentStatus() {
  var modal = document.createElement('div');
  modal.style.position = 'fixed';
  modal.style.width = '300px';
  modal.style.height = '100px';
  modal.style.top = '50%';
  modal.style.left = '50%';
  modal.style.transform = 'translate(-50%, -50%)';
  modal.style.backgroundColor = 'white';
  modal.style.borderRadius = '5px';
  modal.style.display = 'flex';
  modal.style.justifyContent = 'center';
  modal.style.alignItems = 'center';
  modal.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 0.5)';

  var message = document.createElement('p');
  message.innerText = '查询支付状况中';
  message.style.color = '#333';
  
  var dotWrapper = document.createElement('div');
  dotWrapper.style.display = 'flex';
  dotWrapper.style.marginTop = '-9px';
  dotWrapper.style.marginLeft = '10px';

  for (var i = 0; i < 3; i++) {
    var dot = document.createElement('div');
    dot.style.backgroundColor = '#ccc';
    dot.style.width = '10px';
    dot.style.height = '10px';
    dot.style.borderRadius = '50%';
    dot.style.marginRight = '5px';
    dot.style.animation = 'dot-loading 0.6s ' + i * 0.2 + 's infinite';
    dot.style.animationTimingFunction = 'linear';
    dotWrapper.appendChild(dot);
  }

  modal.appendChild(message);
  modal.appendChild(dotWrapper);
  document.body.appendChild(modal);

  // 随机2到5秒后显示未查询到支付账单
  var delay = Math.floor(Math.random() * 4) + 2;
  setTimeout(function() {
    message.innerText = '未查询到支付账单,请支付';
    dotWrapper.style.display = 'none';
    setTimeout(function() {
      modal.remove();
    }, 3000);
  }, delay * 1000);
}

CSS animation loading code:

@keyframes dot-loading {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(0.7); /* 缩小70% */
    }
    100% {
      transform: scale(1);
    }
  }
微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

js move the mouse up to modify the style attribute

js move the mouse up to modify the style attribute Language Notes JavaScript

When the mouse hovers over the element, the color changes to red; when the mouse leaves the element, the color changes to black. To retrieve an element by its ID: `document.getElementById()`; Event handler for mouse hover: `onmouseover`; Event handler for mouse leave: `onmouseout`.<!DOCTYPE html><html lang= "en">...
👁 130

Recommended reading

(Adaptive Mobile Version) Responsive Pink Beauty and Plastic Surgery Center – Cosmetics Industry Enterprise Website Template Source Code Download – 0304

(Adaptive Mobile Version) Responsive Pink Beauty and Plastic Surgery Center – Cosmetics Industry Enterprise Website Template Source Code Download – 0304 Practical Collection pbootcms Template

This is an adaptive, responsive PbootCMS corporate website template designed for the beauty and cosmetic surgery industry. Its sophisticated and elegant design makes it ideal for showcasing services and products offered by beauty and cosmetic surgery clinics as well as cosmetic brand websites. It helps medical aesthetics and beauty brands attract female consumers online. Template Preview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 41
What does "lower abdominal distension" mean?

What does "lower abdominal distension" mean? Hobbies Traditional Chinese Medicine Terminology

In Traditional Chinese Medicine (TCM) theory, "Xinxia Pí" refers to a subjective symptom localized in the epigastric region, typically manifesting as gastric discomfort, a sensation of fullness or oppression, or even symptoms such as gastric pain or vomiting. Xinxia Pí is one of the "Pí syndrome" categories in TCM diagnosis and is commonly observed in various disorders, including gastrointestinal diseases, respiratory system diseases, and cardiovascular diseases. The etiology of Xinxia Pí is diverse and may involve factors such as spleen and stomach deficiency, upward flare of stomach heat, internal retention of phlegm-dampness, or liver qi stagnation. TCM treatment of Xinxia Pí is tailored to the specific clinical presentation...
👁 176
Multi-City Local Information Classification Service Network – 29348 0545

Multi-City Local Information Classification Service Network – 29348 0545 Practical Collection Yiyou template

This EyouCMS professional template is designed for multi-city local information classification service websites. Its design features an information categorization system that enables the display of local city-specific information, categorized services, city switching functionality, and user-generated content. It facilitates the online deployment of classified information service websites for local information platforms. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 61
Eight Extraordinary Meridians

Eight Extraordinary Meridians Hobbies Memo notes

The Ren pulse pulse originates from the center of the cell. The Chong pulse opens an inch outside the Ren meridian and coincides with the kidney meridian. For problems in a woman's uterus, the Ren meridian is in the tube, and the Chong meridian can also be used. The eight extra meridians and their corresponding acupoints are the Du meridian --- Houxi, the Ren meridian --- Lieque, the Chong meridian --- Gongsun --- Lung, heart and chest, and the Dai meridian --- Zu Linwei --- three, surrounding the waist and abdomen. Yang Qiu Meridian---Shen Meridian---Tuyang Point (郄Point)---start from the outer ankle bare---from the back of the neck to the head---...
👁 169
(Adaptive Mobile Version) Responsive Blue Foreign Trade English Website Template – 1004

(Adaptive Mobile Version) Responsive Blue Foreign Trade English Website Template – 1004 Practical Collection pbootcms Template

A responsive blue English-language PbootCMS e-commerce website template supporting both PC and WAP devices. Its international and professional design makes it ideal for businesses to create official English-language e-commerce websites, helping Chinese manufacturing enterprises showcase their brand image and product capabilities in the global market. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles: P...
👁 49