Steps :-
If you want to create popup on the click of a link then you need to follow the following steps.
1. Create link in you HTML file.
<div id="link">
<a href="javascript:openPopUp('http://makecodeeasy.blogspot.in/')">Click Here For open popUp</a>
</div>
2. Create a popUp by HTML and CSS.
<div id="popup" class="popUpDisplay">
<div class="popUpTitle">
<span onClick="closePopUp()"><img alt="Close Popup" src="close.png"/></span>
</div>
<div class="data">
<h3>Welcome to Make Code Easy </h3>
<br>
For getting more knowledge click on Continue
<ul class="buttons">
<li><span class="button" onclick="window.open(link), closePopUp()">Continue</span></li>
<li><span class="button" id="Cancel" onClick="closePopUp()">Cancel</span></li>
</ul>
</div>
</div>
3. Create CSS for divs
.popUpTitle {
background-color: #000000;
height: 40px;
width: 100%;
}
.popUpTitle img {
float: right;
margin-right: 2px;
margin-top: 5px;
}
.data {
background-color: #FFFFFF;
height: auto;
overflow: hidden;
font-size: 14px;
padding: 25px 25px 50px;
width: auto;
}
.buttons li {
cursor: pointer;
float: left;
height: 29px;
margin-right: 15px;
width: 134px;
}
span.button {
background-color: #000000;
color: #ffffff;
font-size: 15px;
font-weight: bold;
padding: 8px 25px;
text-align: center;
}
.popUpDisplay {
display: none;
position: absolute;
width: 440px;
height: 300px;
width: 440px;
left: 250px;
z-index: 1001;
}
.dimLayer {
display: none;
outline: 0px none;
height: 100%;
width: 100%;
background: #A9A9A9;
top: 0px;
left: 0px;
z-index: 900;
position: absolute;
opacity: 0.5;
filter: alpha(opacity=50);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
-khtml-opacity: 0.5;
-moz-opacity: 0.5;
}
4. Create Java Script methods
<script type="text/javascript">
var link;
var element;
function openPopUp(url)
{
link = url;
element = document.getElementById("background");
element.style.display = "block";
element = document.getElementById("popup");
element.style.display = "block";
}
function closePopUp()
{
element = document.getElementById("popup");
element.style.display = "none";
element = document.getElementById("background");
element.style.display = "none";
}
</script>
5. When you click on link then popup opens.
6. Download the full example for checking the output.
Download Full Example
If you want to create popup on the click of a link then you need to follow the following steps.
1. Create link in you HTML file.
<div id="link">
<a href="javascript:openPopUp('http://makecodeeasy.blogspot.in/')">Click Here For open popUp</a>
</div>
2. Create a popUp by HTML and CSS.
<div id="popup" class="popUpDisplay">
<div class="popUpTitle">
<span onClick="closePopUp()"><img alt="Close Popup" src="close.png"/></span>
</div>
<div class="data">
<h3>Welcome to Make Code Easy </h3>
<br>
For getting more knowledge click on Continue
<ul class="buttons">
<li><span class="button" onclick="window.open(link), closePopUp()">Continue</span></li>
<li><span class="button" id="Cancel" onClick="closePopUp()">Cancel</span></li>
</ul>
</div>
</div>
3. Create CSS for divs
.popUpTitle {
background-color: #000000;
height: 40px;
width: 100%;
}
.popUpTitle img {
float: right;
margin-right: 2px;
margin-top: 5px;
}
.data {
background-color: #FFFFFF;
height: auto;
overflow: hidden;
font-size: 14px;
padding: 25px 25px 50px;
width: auto;
}
.buttons li {
cursor: pointer;
float: left;
height: 29px;
margin-right: 15px;
width: 134px;
}
span.button {
background-color: #000000;
color: #ffffff;
font-size: 15px;
font-weight: bold;
padding: 8px 25px;
text-align: center;
}
.popUpDisplay {
display: none;
position: absolute;
width: 440px;
height: 300px;
width: 440px;
left: 250px;
z-index: 1001;
}
.dimLayer {
display: none;
outline: 0px none;
height: 100%;
width: 100%;
background: #A9A9A9;
top: 0px;
left: 0px;
z-index: 900;
position: absolute;
opacity: 0.5;
filter: alpha(opacity=50);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
-khtml-opacity: 0.5;
-moz-opacity: 0.5;
}
4. Create Java Script methods
<script type="text/javascript">
var link;
var element;
function openPopUp(url)
{
link = url;
element = document.getElementById("background");
element.style.display = "block";
element = document.getElementById("popup");
element.style.display = "block";
}
function closePopUp()
{
element = document.getElementById("popup");
element.style.display = "none";
element = document.getElementById("background");
element.style.display = "none";
}
</script>
5. When you click on link then popup opens.
6. Download the full example for checking the output.
Download Full Example
thankyu bosssssssss
ReplyDeleteThis is really simple - even for a script noob as me - and thus simply great!
ReplyDeleteUnfortunately, when using it for youtube videos, I have an issue. When closing the popup containing the video, the audio from the video is still being played back in the background. I found several options to stop the video (youtube API etc.), however, I wasn't able to combine them with your elegant popup solution.
It would be great if you would have a hint in the right direction.
Either way, many thanks for the instructions!
Georg
great tip! could you please share the code for auto popup on page load? Thanks
ReplyDeletewrite this code in script tag.
ReplyDeletewindow.onload = openPopUp('http://makecodeeasy.blogspot.ins');
Is Javascript has be written in separate file? IF so, it has to saved under what name? Sorry for the dumb question, new to this.
ReplyDeletewhere is #popUp - ID values at CSS?
ReplyDeletewhere is #popUp - ID values at CSS?
ReplyDeleteHere we are using class values (".popUpDisplay") in css file instead of ID values.
In starting display value of .popUpDisplay is none so popup div is invisible. But after clicking on the link we changed display block to popup div. so now popup div is visible.
We can change this code .popUpDisplay { } of css by #popup{ } this code.
or you can get div by class name instead of id value.
document.getElementsByClassName("popUpDisplay")
Thanks
Thanks for sharing this.
ReplyDeleteREDUCE BOUNCE RATE
I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog.
ReplyDeletebest rpa training in bangalore
rpa training in bangalore | rpa course in bangalore
RPA training in bangalore
rpa training in chennai
rpa online training
I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
ReplyDeletepython Course in Pune
python Course institute in Chennai
python Training institute in Bangalore
Easily, the article is actually the best topic on this registry related issue. I fit in with your Python classes in pune conclusions and will eagerly look forward to your next updates.
ReplyDeleteI just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
ReplyDeletedata analytics course hyderabad
Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteamazon web services aws training in chennai
microsoft azure training in chennai
workday training in chennai
android-training-in chennai
ios training in chennai
Wonderful post and more informative!keep sharing Like this!
ReplyDeleteFull stack developer course in Bangalore
Full stack developer course in Pune
Mmorpg Oyunlar
ReplyDeleteinstagram takipçi satın al
TİKTOK JETON HİLESİ
Tiktok jeton hilesi
Sac ekim antalya
referans kimliği nedir
instagram takipçi satın al
metin2 pvp serverlar
TAKİPCİ SATİN AL
perde modelleri
ReplyDeleteNumara onay
TURKCELL MOBİL ÖDEME BOZDURMA
nft nasıl alınır
Ankara Evden Eve Nakliyat
TRAFİK SİGORTASI
Dedektör
web sitesi kurma
Aşk romanları
smm panel
ReplyDeletesmm panel
iş ilanları
instagram takipçi satın al
hirdavatciburada.com
beyazesyateknikservisi.com.tr
servis
tiktok jeton hilesi
beykoz alarko carrier klima servisi
ReplyDeleteüsküdar alarko carrier klima servisi
pendik beko klima servisi
tuzla toshiba klima servisi
maltepe lg klima servisi
kadıköy lg klima servisi
maltepe alarko carrier klima servisi
kadıköy alarko carrier klima servisi
maltepe daikin klima servisi
كيفية تنظيف مروحة سقف الحمام
ReplyDelete9 طرق سحرية لاستخدام الزيوت العطرية او المعطرات في التنظيف
Success Write content success. Thanks.
ReplyDeletecanlı slot siteleri
canlı poker siteleri
betturkey
betmatik
kıbrıs bahis siteleri
deneme bonusu
betpark
betmatik
ReplyDeletekralbet
betpark
mobil ödeme bahis
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
DZSMO4
Vidal International's Data Science Course in Vizag offers comprehensive training in the field of data science. Learn essential skills such as data analysis, machine learning, and predictive modeling from industry experts. Gain hands-on experience through practical projects and develop the expertise to extract valuable insights from complex datasets. Join our course and embark on a rewarding journey in the world of data science.
ReplyDeleteçorum
ReplyDeleteantep
ısparta
hatay
mersin
FOHNT7
great Post.
ReplyDeleteFull-stack course in Nagpur
salt likit
ReplyDeletesalt likit
dr mood likit
big boss likit
dl likit
dark likit
QS3
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
İVRJ
Thanks for sharing such wonderful post.
ReplyDeleteJava training in Nagpur
Nice Post . Thanks for sharing
ReplyDeleteJava Training in Solapur
van
ReplyDeletezonguldak
yalova
urfa
gümüşhane
AH3UX
urfa evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
burdur evden eve nakliyat
kırıkkale evden eve nakliyat
kars evden eve nakliyat
001PİU
F5E9C
ReplyDeleteÇerkezköy Organizasyon
Keep Coin Hangi Borsada
Aydın Evden Eve Nakliyat
Niğde Lojistik
Kayseri Lojistik
Bitmart Güvenilir mi
Tunceli Evden Eve Nakliyat
Balıkesir Şehir İçi Nakliyat
Casper Coin Hangi Borsada
18677
ReplyDeleteDenizli Parça Eşya Taşıma
Muş Parça Eşya Taşıma
Binance Referans Kodu
Çerkezköy Televizyon Tamircisi
Isparta Parça Eşya Taşıma
Altındağ Fayans Ustası
Yozgat Şehir İçi Nakliyat
İstanbul Şehirler Arası Nakliyat
Gümüşhane Lojistik
120F3
ReplyDeleteManisa Lojistik
Çerkezköy Parke Ustası
Kastamonu Lojistik
Osmaniye Şehirler Arası Nakliyat
https://peptidci.com/
Etlik Boya Ustası
Mersin Evden Eve Nakliyat
Çerkezköy Motor Ustası
sustanon
B58C8
ReplyDeleteTekirdağ Evden Eve Nakliyat
Denizli Evden Eve Nakliyat
Burdur Evden Eve Nakliyat
Ünye Fayans Ustası
Referans Kimliği Nedir
Uşak Evden Eve Nakliyat
Altındağ Fayans Ustası
Mercatox Güvenilir mi
Vindax Güvenilir mi
91FF5
ReplyDeleteKars Lojistik
Bitlis Şehirler Arası Nakliyat
Adana Şehirler Arası Nakliyat
order clenbuterol
Antalya Evden Eve Nakliyat
Tokat Evden Eve Nakliyat
Adıyaman Şehirler Arası Nakliyat
Uşak Şehir İçi Nakliyat
Malatya Evden Eve Nakliyat
D7F59
ReplyDeleteSilivri Boya Ustası
İzmir Evden Eve Nakliyat
Amasya Evden Eve Nakliyat
Çerkezköy Kurtarıcı
Eryaman Fayans Ustası
Sincan Fayans Ustası
Altındağ Boya Ustası
Bursa Evden Eve Nakliyat
Keçiören Parke Ustası
EE43B
ReplyDeleteBitcoin Nasıl Alınır
Binance Yaş Sınırı
Kripto Para Nasıl Alınır
Bulut Madenciliği Nedir
Coin Nedir
Coin Üretme Siteleri
Kripto Para Madenciliği Siteleri
Kripto Para Üretme Siteleri
Binance Madencilik Nasıl Yapılır
8E2D7
ReplyDeleteCoin Nasıl Kazılır
Kripto Para Nasıl Çıkarılır
Binance Madenciliği Nedir
Coin Nasıl Kazılır
Binance Madencilik Nasıl Yapılır
Binance Borsası Güvenilir mi
Binance Sahibi Kim
Mexc Borsası Kimin
Bitcoin Nasıl Kazanılır
6C239
ReplyDeletekaraman görüntülü sohbet kızlarla
zonguldak parasız sohbet
van telefonda kadınlarla sohbet
erzurum görüntülü sohbet siteleri
adıyaman nanytoo sohbet
manisa bedava sohbet odaları
bedava görüntülü sohbet
canli sohbet bedava
yozgat yabancı görüntülü sohbet siteleri
52725
ReplyDeleteFacebook Grup Üyesi Hilesi
Paribu Borsası Güvenilir mi
Gate io Borsası Güvenilir mi
Kripto Para Kazanma
Dxgm Coin Hangi Borsada
Telegram Görüntüleme Hilesi
Referans Kimliği Nedir
Soundcloud Reposts Satın Al
Arbitrum Coin Hangi Borsada
CEB25
ReplyDeleteLikee App Takipçi Hilesi
Snapchat Takipçi Hilesi
Binance Referans Kodu
Coin Çıkarma
Bitcoin Üretme Siteleri
Kripto Para Üretme Siteleri
Bitcoin Kazanma
Bitcoin Kazanma
Kripto Para Nedir
0A720
ReplyDeleteshea butter sabunu
4g mobil
bingx
paribu
coin nereden alınır
btcturk
bitget
kızlarla canlı sohbet
huobi
03E66
ReplyDeletebitexen
kripto telegram
kucoin
bybit
coin nereden alınır
binance
binance referans kodu
coin nasıl alınır
canlı sohbet
3D490
ReplyDeleteJuly 2024 Calendar
paribu
aax
canlı sohbet ucretsiz
huobi
huobi
bitexen
April 2024 Calendar
bibox
FCE2D
ReplyDelete----
----
----
----
----
matadorbet
----
----
----
This comment has been removed by the author.
ReplyDeleteyhujytijkuyj
ReplyDeleteصيانة افران البا جدة
GNBBGVN HBGV
ReplyDeleteشركة تسليك مجاري بالدمام
شركة تسليك مجاري بالدمام Xk8CGitlBN
ReplyDeleteشركة تسليك مجاري بابها 7oH2OBtmVr
ReplyDeleteشركة صيانة افران بالاحساء gM4BK9ztIf
ReplyDeleteشركة رش مبيدات بالاحساء sNHHSG11Ts
ReplyDelete<a href="https://alryan-services.com.sa/%d8%b4%d8%b1%d9%83%d8%a9-%d8%b9%d8%b2%d9%84-%d8%a7%d8%b3%d8%b7%d8%ad-%d8%a8%d8%b5%
ReplyDelete