Forum Moderators: open

Message Too Old, No Replies

Popup window not popping up!

popup window, java,

         

Silver007A

12:52 pm on Nov 18, 2009 (gmt 0)

10+ Year Member



Hi Guys and Gals,

I am new to java and haven't much of a clue.

I cant get my pop up to work. It was designed to finction on the click of a button but I would like it to appear when the page loads for login and newsletter purposes.

Any ideas would be great.

Thanks

<script type="text/javascript" src="popup-window.js"></script>
</head>
<body>
<script>window.onload=function(){
<div class="sample_popup" id="popup" style="display: none;">
<div class="menu_form_header" id="popup_drag">
<img class="menu_form_exit" id="popup_exit" src="form_exit.png" alt="" />
&nbsp;&nbsp;&nbsp;Login
</div>
<div class="menu_form_body">
<form action="sample.php">
<table>
<tr><th>Username:</th><td><input class="field" type="text" onfocus="select();" name="username" /></td></tr>
<tr><th>Password:</th><td><input class="field" type="password" onfocus="select();" name="password" /></td></tr>
<tr><th> </th><td><input class="btn" type="submit" value="Submit" /></td></tr>
</table>
</form>
</div>
</div>
}
</script>

Fotiman

2:15 pm on Nov 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



First, Java is not the same thing as JavaScript. They are two very different languages.

Second, popups the fire without user interaction (such as those that fire on page load) will most likely be blocked by popup blockers.

Third, you have a window.onload function defined, but it contains HTML instead of JavaScript code, which it invalid. I suspect that you really want that HTML to be included in the body of your document outside of the <script> element. I also suspect that there is a function within your popup-window.js script that takes the id ('popup') and positions it on the page. I think you're going to need to post a little more code in order to know what's going on.