Jump to content
xisto Community
soleimanian

How To Create A Popup Window With Javascript?

Recommended Posts

You can try this code, Its correct

How To Create A Popup Window With Javascript?

 

<HEAD>

 

 

 

 

<!-- STEP TWO: Use the following button code for the new window -->

 

<form>

<input type=button value="Popup Window" onClick="javascript:popUp('This area please mention the your Folder or file')">

</form>

 

-Ganesh

Share this post


Link to post
Share on other sites

Call javascript from server side

How To Create A Popup Window With Javascript?

 

Hello friends,

 

I have one Query in javascript.. I call javascript function server side without any event fire like onblur,mouseover etc. And after the function then return server side..

 

Please help me this query

 

 

Regards,

Prashant

 

-reply by prashant

Share this post


Link to post
Share on other sites

I think the common way to create a popup with JavaScript is using Div elements.

You can simply put any Html code into the tag DIV and make this Div unvisible.

For example:

 

<body>
......

<DIV id="myTestDiv" style="left:-1000px;top:-1000px;disply:none;position:absolute;'>
   <table border=1>
       <tr>
          <td>Menu Item 1</td>
       </tr>
       <tr>
          <td>Menu Item 2</td>
       </tr>
   </table>
</DIV>
.....
</body>

 

When my popup window (created as Div element) is unvisible, I do not worry about its location on the screen - it does not matter. That's way I put negative values for top and left coordinates.

However, before visualing I should move it to appropriated location. It can be done by JavaScript using attribute style. For example, I can move my popup to any absolute location on current page:

<script language='javascript'>
function moveMyPopup() {
 var mypopup = document.getElementById('myTestDiv');
 mypopup.style.top = '25px';
 mypopup.style.left = '100px';
}
</script>

After moving I can do it visible:

pop.style.display = '';

Or hide it again:

pop.style.display = 'none';

Share this post


Link to post
Share on other sites

Comment to my previous message:Div elements are used very often for creating poipup menu on the first (main) page of Web sites.But we have to keep in mind, that different browser have different Javascript systacsis for moving and hiding/showing elements on the screen.Look at documentation attentively!

Edited by java-area (see edit history)

Share this post


Link to post
Share on other sites

check this simple codeHow To Create A Popup Window With Javascript?

Simple Popup window

You can use this code, the condition <if(b= =0)>  used to break the popup when mouse button is clicked more than once

<script type="text/javascript">Var b=0;Function Avinash(){

if(b==0){

window.Open("https://www.google.de/?gfe_rd=cr&ei=7AkjVIatDsKH8QfNkoC4DQ&gws_rd=ssl;);

B++;}}</script><body bgcolor="black" onclick="Avinash();" style={"cursor : pointer"}><br><br>

<font color=#0099b9 size=5><center>Simple PopUp window</center></font>

-reply by Avinash an Assassin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.