|
|
|
|
![]() ![]() |
Jan 11 2006, 04:20 PM
Post
#11
|
|
|
Member [ Level 1 ] Group: Members Posts: 37 Joined: 23-June 05 Member No.: 6,514 |
I know of another simple way to make a window pop-up so you can suggest to your visitors to make your site their homepage.
CODE function popUp() { alert("Please make my site your homepage!"); } You just put the code above together with your other script code in the <script> tag -- that is within the <head> tag. How it works is that the "alert" function will pop up as an alert box and whatever message you want your site visitors to see first when they get to your site will be displayed in small pop-up window (AKA the alert box). In between the quotations within the parenthesis is what will appear in the alert box. I just put "Please make my site your homepage!" as an example but you can change that part of the message to whatever you want it to be. And now, in the body tag, have the following: CODE <body onload="popUp()"> This code is as oveture explains. It will call the function called (well, in this case) "popUp()" and "onload" (which means that when your webpage loads), the function being called will be executed. So... if you don't have the "onload" function in the <body> tag, the script from how to pop-up a window will not work. Okay, I hope that helps you out. A really simply code and I believe it fits what you are asking for. ^__^ Regards, -- scryoko |
|
|
|
Feb 12 2006, 11:19 PM
Post
#12
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 5 Joined: 12-February 06 From: Nebraska Member No.: 11,249 |
It depends on what type of prompt/alert you want.
For example, if you want to have a pop-up on a page when someone enters it, use this code: CODE <script language="JavaScript type="text/javascript"">alert("Place your message here!")</SCRIPT> Or you can get one that pops up when someone leaves the page: CODE <body onunload="alert('Place your message here!');"> Also, there is one when a visitor moves their pointer over a link: CODE <a href=""onMouseover="alert('Place your message here!')">Put the text you want to be visible here.</a> Or if you want something more cool, make one that says the time and date upon entering a page: CODE <script language="JavaScript" type="text/javascript"> document.write("Having a great day?") document.write("<BR>") document.write("Today's date is ",Date()) </script> Finally, you could use one that comes up when you enter and leave a page. CODE <body onload="alert('Place your message here!');"
onunload="alert('Place your second message here!');"> |
|
|
|
Feb 14 2006, 01:56 PM
Post
#13
|
|
|
Little MechBirdie Group: Members Posts: 299 Joined: 23-March 05 From: Down here in Holland Member No.: 3,178 |
Can't you make a question window with Javascript? I'm not an expert on Javascript (I actually don't know anything about it), but I know it can be done in VB, problem is, can it be done in Javascript? Something like this:
CODE if(!isAdded) { // use a var from a cookie to check wether your site is already added to favorites if(question("Do you want to make my site your homepage") { // Ask to add this site window.external.AddFavorite(location.href, document.title); } } I'm almost sure this isn't correct javascript and I don't know how to use cookies, so plz rewrite this code, but isn't this a nice idea instead of the popup? -=jeroen=- |
|
|
|
Feb 14 2006, 05:51 PM
Post
#14
|
|
|
Veteran Nut Group: Members Posts: 527 Joined: 4-October 05 From: UK Member No.: 8,895 |
Grrr. You're the type of person we all don't like. j/k.
NEVER EVER EVER EVER HAVE POP-UPS ON YOUR SITE TO ASK PEOPLE TO DO SOMETHING. If they want to make your site part of their favourites, then they will do. If they want to make it their home page, then they will do. If they don't have the technical knowledge, then use simple inline javascript as well as a link to achieve the effect. It is possible to create in document pop-ups, using AJAX, but I aint telling you how, as I do not know myself. |
|
|
|
Sep 26 2007, 09:01 PM
Post
#15
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
I have a further question. How can I actually create multiple pop-ups that trigger by a mouse click over a particular area in a picture! I WILL ACCEPT ANY SUGGESTIONS OR SCRIPT THAT MAY HELP and give me an idea or two!!! THanks
-Badi |
|
|
|
Feb 14 2008, 08:00 PM
Post
#16
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
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 |
|
|
|
Apr 1 2008, 09:59 PM
Post
#17
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 2 Joined: 1-April 08 Member No.: 29,551 |
Hey I made a tut on youtube.
Here's the link: http://youtube.com/watch?v=1KTe6mWhBq0 There's no sound. But it tells you how to make a simple pop-up box. |
|
|
|
Apr 9 2008, 08:42 AM
Post
#18
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
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 |
|
|
|
Apr 15 2008, 09:19 PM
Post
#19
|
|
|
Member [ Level 1 ] Group: [HOSTED] Posts: 47 Joined: 4-February 08 Member No.: 28,119 |
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: HTML <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: HTML <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'; |
|
|
|
Apr 16 2008, 02:35 PM
Post
#20
|
|
|
Member [ Level 1 ] Group: [HOSTED] Posts: 47 Joined: 4-February 08 Member No.: 28,119 |
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! This post has been edited by java-area: Apr 16 2008, 02:36 PM |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd August 2008 - 01:37 AM |