由于原生的alert和confirm在不同手机上显示样式不一样,而且也难看。所以用css模拟了原生的alert和confirm实现。
具体代码如下:
<!DOCTYPE html><html><head><title>confirm和alert的demo</title><meta charset="UTF-8"><script src="jquery.min.js"></script><style type="text/css">/*w-error-popup-white*/.w-error-popup-white{ width: 100%; height: 100%; z-index: 999; position: fixed; left: 0; top:0;}.w-error-popup-white .w-error-back{ width: 100%; height: 100%; background-color: rgba(0,0,0,.8); position:fixed; z-index: 1000; left: 0; top:0;}.w-error-popup-white .w-error-inner{ background-color: #fff; width: 90%; top: 15%; left: 50%; margin-left: -45%; text-align: center; border-radius: 20px; padding: 0; z-index: 1001; position: relative;}.w-error-popup-white .w-error-inner h4{ font-size: 20px; color: #333; padding: 16px 0; margin: 0 32px; border-bottom: 1px solid #e5e9ec; font-weight: normal; }.w-error-popup-white .w-error-inner .w-error-content{ color: #333; font-size: 16px; line-height: 45px; padding: 32px; height: 270px; overflow-y:auto; overflow-x:hidden; text-align: left; }.w-close{ background: url(../images/result-error-x.png) no-repeat right 16px; float: right; right:18px; top:0; position:absolute; z-index: 999; width: 100px; height:85px; cursor:pointer; display: block; background-size:60%;}/*u-btn */.u-btn{ padding: 16px 80px; background-color: #92c153; border-bottom: 5px solid #7da646; border-radius: 8px; color: #fff; display: inline-block; vertical-align: middle;}.u-btn-red{ background-color: #ec7d69; border-color: #e95c44;}</style></head><body><input type="button" value="模拟confirm" id="confirmId" onclick="confirmClickMethed()"/><input type="button" value="模拟alert" id="alertId" onclick="alertClickMethed()"/> <!-- 所有页面都共享confirm提示框 --> <div id="w-error-popup-white" style="display: none;" class="w-error-popup-white"> <div class="w-error-back"></div> <div class="w-error-inner"> <div id="w-confirm-content" class="w-error-content" style="height: auto; font-size: 26px;"> 取消后不能恢复,确定取消么?</div> <div class="btn" style="padding: 1rem; text-align: right;"> <a class="u-btn u-btn-red" href="javascript:canclePopup();">取消</a> <a id="sure" class="u-btn" href="javascript:sure();">确定</a> </div> </div> </div> <!-- 所有页面都共享alert提示框 --> <div id="w-alert-popup-white" style="display: none;" class="w-error-popup-white"> <div class="w-error-back"></div> <div class="w-error-inner"> <div id="w-alert-content" class="w-error-content" style="height: auto; font-size: 26px;"> 这是提示内容 </div> <div class="btn" style="padding: 1rem; text-align: right;"> <a class="u-btn u-btn-red" href="javascript:alertHide();">确定</a> </div> </div> </div> <script type="text/javascript"> function sure(){ $("#w-error-popup-white").hide(); alert("确定"); }function canclePopup(){ $("#w-error-popup-white").hide();}function alertHide(){ $("#w-alert-popup-white").hide();}function confirmClickMethed(){ $("#w-confirm-content").html("这是一个confirm内容,取消还是确认呢?"); $("#w-error-popup-white").show();}function alertClickMethed(){ $("#w-alert-content").html("这是一个alert内容"); $("#w-alert-popup-white").show();}</script></body></html>
文件需要引入jquery。下载地址为:
链接: http://pan.baidu.com/s/1qWxOoC8 密码: w541

HTML의 역할은 태그 및 속성을 통해 웹 페이지의 구조와 내용을 정의하는 것입니다. 1. HTML은 읽기 쉽고 이해하기 쉽게하는 태그를 통해 컨텐츠를 구성합니다. 2. 접근성 및 SEO와 같은 시맨틱 태그 등을 사용하십시오. 3. HTML 코드를 최적화하면 웹 페이지로드 속도 및 사용자 경험이 향상 될 수 있습니다.

"Code"는 "Code"BroadlyIncludeLugageslikeJavaScriptandPyThonforFunctureS (htMlisAspecificTypeofCodeFocudecturecturingWebContent)

HTML, CSS 및 JavaScript는 웹 개발의 세 가지 기둥입니다. 1. HTML은 웹 페이지 구조를 정의하고 등과 같은 태그를 사용합니다. 2. CSS는 색상, 글꼴 크기 등과 같은 선택기 및 속성을 사용하여 웹 페이지 스타일을 제어합니다.

HTML은 웹 구조를 정의하고 CSS는 스타일과 레이아웃을 담당하며 JavaScript는 동적 상호 작용을 제공합니다. 세 사람은 웹 개발에서 의무를 수행하고 화려한 웹 사이트를 공동으로 구축합니다.

HTML은 간단하고 배우기 쉽고 결과를 빠르게 볼 수 있기 때문에 초보자에게 적합합니다. 1) HTML의 학습 곡선은 매끄럽고 시작하기 쉽습니다. 2) 기본 태그를 마스터하여 웹 페이지를 만들기 시작하십시오. 3) 유연성이 높고 CSS 및 JavaScript와 함께 사용할 수 있습니다. 4) 풍부한 학습 리소스와 현대 도구는 학습 과정을 지원합니다.

anexampleStartingtaginhtmlis, whithbeginsaparagraph.startingtagsareessentialinhtmlastheyinitiate rements, definetheirtypes, andarecrucialforstructurituringwebpages 및 smanstlingthedom.

메뉴에서 점선 분할 효과를 설계하는 방법은 무엇입니까? 메뉴를 설계 할 때는 일반적으로 접시 이름과 가격 사이에 왼쪽과 오른쪽을 정렬하는 것이 어렵지 않지만 점선 또는 중간의 점은 어떻습니까?

웹 코드 편집기의 HTML 요소 분석 많은 온라인 코드 편집기를 사용하면 사용자가 HTML, CSS 및 JavaScript 코드를 입력 할 수 있습니다. 최근에 누군가가 제안했습니다 ...


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

WebStorm Mac 버전
유용한 JavaScript 개발 도구

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기
