Skip to main content

Pop-up Using div tag

Hi Bloggies,
                    Here I come up with one more interesting technical  post. You have come across javascript many times and there you could find script for opening a new window by clicking some text or button. But, this has various constraints like if you use open.window() method it will open a new window replacing the existing one. This may sometimes cause problems in opening because browsers expects this to be a pop up window and wont allow you to open it. Here comes the simple solution. Use div tag and produce a onclick event. Try it out guys. This is such a simple code that the one tries it, doesn’t need to be a pro in technology. Here is the scenario which I came across. Visiting a website, I found a option called “Send to a Friend” . I clicked it and I found a small window popped up infront of me with existing website contents as it is. How does it work? Here, goes the code.

 HTML CODE FOR THE TEXT YOU NEED TO CLICK
<div id=”share”><h2><span onclick=”popup()”>Click here to tell a friend</span><h2></div>
Write this HTML code in body tag of your HTML.
YOUR HTML FORM WHICH CONTAINS FROM AND TO ADDRESS
<div id=”layer”>
<div id=”email”>
<div id=”from”>From</div>
<div id=”sender” >
First Name<input type=”text” alt=”firstn”/><br><br>
Last Name<input type=”text” alt=”lastn”/><br><br>
Email Address<input type=”text” alt=”addr”/>
</div>
<div id=”to”>To</div>
<div id=”reciever”>Email Address <input type=”text” alt=”addr”/><br><br></div>
<div id=”send”><center>Send </center></div>
</div>
<div id=”close”><span onclick=”close1()”>Close</span></div>
</div>

This div layer is position absolute which means you can write anywhere in your HTML body tag and use it accordingly.
ADD A PINCH OF CSS
#layer {
 position:absolute;
 display:none;
 width: 500px;
 height: 450px;
 background-color:#e0e0e0;
 border: 1px solid #000;
 z-index:50;
 }

#sender
{
float:left;
height:225px;
width:300px;
}

#receiver
{
float:left;
height:225px;
width:300px;
}

#send
{
margin-left:100px;
height:30px;
width:100px;
border-style:solid;
border-width:3px;
border-color:#008B8B;
color:#008B8B;
}

#close
{
margin-left:450px;
}

You can add this CSS in link tag in head tag of the HTML or just write the CSS in your code. You can add your own CSS according to your favourite colors and styles.
ADD JAVASCRIPT FOR YOUR ONCLICK EVENT
<script type=”text/javascript”>
function popup()
{
document.getElementById(”layer”).style.display=”block”;
}
function close1()
{
document.getElementById(”layer”).style.display=”none”;
}
</script>

Add this Javascript in your head tag or just create a seperate .js file and add the link.
Try it out and have fun…. Happy reading..!!!

Comments

Popular posts from this blog

English Translation of "Voda Voda " song from Mayakam Enna

Hi guys        Too many Tamil post and my Non-Tamil readers would have really bugged up with my previous posts. Many non-tamil people who hear this song "Voda Voda Voda" from Mayakam Enna is wondering what is the exact meaning of this song. They don't know the meaning but still they enjoy it. Now read this post, know the meaning and sing it along.        I have differentiated the original lyrics of the song in blue color and the meaning of it in the next line in red color. Here we go... Voda voda voda thooram korayala... Running running running distance didn't get reduced... Paada paada  paada paatum mudiyala... Singing singing singing song didn't get over... Poga poga poga onum puriyala, aaga motham onum velangala... Time passing by nothing able to grasp, totally nothing understood... Free ah suthum podhu figure illaye... While roaming freely figure was not there... Pudicha figurum ipa free ah illaye... The figure I liked is not free now.. Kayil bat iruku

செந்தாழம் பூவில் வந்தாடும் தென்றல் (Senthazham poovil vandhaadum thendral) song lyrics and meaning

                I am so astonished by the creativity of Kaviyarasu Kannadasan and the language itself. This is one of my favourite song in the tamil movie called Mullum Malarum. Wonderful movie with extraordinary music composition by famous Isaigyaani Ilayaraja sir.                  I will try giving the exact meaning of this song which portrays how beautiful women are and you can relate to anything which comes to your mind when you read it along. Kannadasan , Ilayaraja and K.J.Yesudas , a combination that shouldn't be missed. Song :   Senthaazham poovil vandhaadum thendral Lyrics : Kannadasan Music : Ilayaraja Singer : K.J.Jesudas செந்தாழம் பூவில் வந்தாடும் தென்றல்  என் மீது மொதுதமா.. (x2) பூ வாசம் மேடை போடுதம்மா  பெண் போல ஜாடை பேசுதம்மா.. அம்மம்மா ஆனந்தம்.. அம்மம்மா ஆனந்தம்.. Senthaazham poovil vandhaadum thendral  En meedhu modhudhamaa.. Poo vaasam medai podudhamaa Penn pola jaadai pesudhamma.. Ammammaa aanandham.. ammammaa aanandham.

Rasaali Song Lyrics and Translation - To my best (Achcham Enbadhu Madamaiyada)

          I have tried my best to translate this awesome composition of A.R.Rahman - Rasaali for the movie அச்சம் என்பது மடமையடா (Acham Enbadhu Madamaiyada) which lazy people tend to call it AEM. Tamil is such a beautiful language, its difficult to get the exact ecstasy until you know the language. Divinity at its best.  Movie is not yet released, but I guess the situation is lead actor and actress is going on a bike ride when they sing this song to express their feelings. Credits to lyricist Thamarai. Song :   Rasaali Lyrics : Thamarai Music : A.R.Rahman Singers : Sathya Prakash, Shashaa Tirupati Male: Parakkum rasaaliye rasaaliye nillu.. Ingu nee vegama naan vegama sollu.. Gadigaaram poi sollum endre naan kanden.. Kizhakellam merkaagida.. kandene.. பறக்கும் இராசாலியே இராசாலியே நில்லு.. இங்கு நீ வேகமா நான் வேகமா சொல்லு.. கடிகாரம் பொய் சொல்லும் என்றே நான் கண்டேன்.. கிழக்கெல்லாம் மேற்காகிட.. கண்டேனே.. Flying falcon, please wait..  (Comparing his girl to a