Hello,
I am developing an application in PHP,in which i wanted to set an alert that displays an popup massage which suggest to visitors of my site to make my site their home page. For that i have decided to use Javascript.
Please help
Hello,
I am developing an application in PHP,in which i wanted to set an alert that displays an popup massage which suggest to visitors of my site to make my site their home page. For that i have decided to use Javascript.
Please help
you can use a the <body onload="..."> event. in the BODY tag and then call the function from the javascript file to load, something like this:
The above code calls the function from the Javascript file or if you have it embedded in the webpages. The below code is what you need to open the page in the popup, this can be pasted into an external file which contains all the javascript or embedded.Code:<body onload="popup()">
Code:function popup() { window.open("popuppage.html","Homepage","resizable=no,status=yes,scrollbars=yes,width=260,height=500"); }
The JavaScript Alert is the simplest and the most often used of the three available JavaScript pop-up dialog boxes. It's one simple job is to display a message to the user. When the browser reaches the point in the script that triggers the Alert, the Alert popup box is displayed on the screen and all other operations are suspended until the user confirms they have read the message by clicking the 'OK' button. It is obviously useful for displaying a message to the user but it is also very useful for debugging JavaScript scripts. You place it inline in the script you are developing and use it to display the value of variables, form input fields, etc.
There are many different ways you can call an Alert but we are going to use a JavaScript link that calls a JavaScript function called 'javascript_alert_demo', which in turn will prepare and call the Alert built-in function. You should note that an Alert requires one argument (the message) and it returns no value.
Following is the JavaScript popup window that has the following code:
Now, that is a prime example of a worthless popup! When you make your own, try to have them relate to your content, like a small popup with no navigation that just gives the definition or explanation of a word, sentence, or picture!Code:<head> <script type="text/javascript"> <!-- function myPopup2() { window.open( "http://www.google.com/", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" ) } //--> </script> </head> <body> <form> <input type="button" onClick="myPopup2()" value="POP2!"> </form> <p onClick="myPopup2()">CLICK ME TOO!</p> </body>
Bookmarks