rejetto forum
May 24, 2012, 03:10:47 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Help for JavaScript  (Read 2715 times)
0 Members and 1 Guest are viewing this topic.
Alons0
Tireless poster
****
Offline Offline

Bulgaria Bulgaria

Posts: 197



View Profile WWW Email
« on: May 09, 2007, 07:43:45 AM »

I wanna when i enter in my site to be open one more window for information (like popup but i don't wanna be allert) How can I make this by JavaScript?
Logged

TSG
Operator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #1 on: May 09, 2007, 08:11:31 AM »

HTML /  JAVASCRIPT:
<body onload="window.open('***URL OF HTML FILE***','****WINDOW NAME****','width=640,height=480,left=100,top=100,scrollbars=yes,resizable=yes')">

That should do it, just make a html document and put the url in the javascript, then when the page loads they see this... only problem is they will see it for EVERY page load, but with some further javascript you could fix this have a function like the below psuedocode.

HTML:
<body onload="popUp('some variable');">

JAVASCRIPT:
function popUp (some variable) {
if (some variable = "something" /*this is the login page*/) {
        window.open('***URL OF HTML FILE***','****WINDOW NAME****','width=640,height=480,left=100,top=100,scrollbars=yes,resizable=yes');
} else {
        return null;
}

I could show you how to do it completely with javascript but it gets quite complex very quickly.

But i will post an example code of how to build html and css in a popup fully in javascript anyway Tongue this is a registration form idea we had a looong time ago, if you can make it from that code, go for it!

Code:
function openBox() {
popup=window.open('','Contact','height=325,width=490,resizable=yes,scrollable=yes');
var win = popup.document;
win.write('<html><head><title>Registration</title>'); win.write('<style>body{margin:0px;padding:0px;font-size:12px;font-family:Tahoma;background-color:#ECF0F6;height:100%;color:#036;}.infobox{border:1px solid #fff;padding:5px;}.infohder{border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #fff;}.content{background-color:#EAEDF4;border:1px solid #004480;margin:10px;}th{background-color:#036;color:#fff;height:30px;border-left:1px solid #fff;}</style>');
win.write('</head><body>');
win.write('<div class=content><table cellspacing=0 cellpadding=0 border=0 width="100%"><tr><th class=infohder align=center>Registration Form</th></tr><tr><td class=infobox align=left>');
win.write('<form id="feedback" name="feedback" method="post" action="mailto:" enctype="text/plain" onSubmit="return checkForm()">');
win.write('<br><label>Real Name: <input name="field_name" type="text" size="25"/></label><br><br>');
win.write('<label>Desired Password: <input name="field_password" type="text" size="10"/> 10 characters max.</label><br><br>');
win.write('<label>Login Name: <input type="text" name="field_login" size="20"> (if different from Real NAME)</label><br><br>');
win.write('<label>Connection Speed: <input type="text" name="field_speed" size="6"/> kbps.<label><br><br>');
win.write('<label>E-mail: <input name="field_email" type="text" id="sender" size="25"/></label><br><br>');
win.write('<center><input type="submit" name="submit" value="Submit" />&nbsp;&nbsp;&nbsp;<input name="reset" type="reset" value="Reset"/>&nbsp;&nbsp;&nbsp;<input type="button" name="cancel" value="Cancel" onclick="javascript:self.close()"></center>');
win.write('</form></td></tr></table></div></body></html>');
}
« Last Edit: May 09, 2007, 08:17:30 AM by That_Stevens_Guy » Logged

Alons0
Tireless poster
****
Offline Offline

Bulgaria Bulgaria

Posts: 197



View Profile WWW Email
« Reply #2 on: May 09, 2007, 08:48:31 AM »

Please show me how can i run it completely? I can't do it alone
« Last Edit: May 09, 2007, 08:53:22 AM by Alons0 » Logged

TSG
Operator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #3 on: May 09, 2007, 10:00:57 AM »

I'm sorry i cant help now, if you haven't sorted it out by tomorrow night, i will make it work. But its 1am and im sleeping Smiley
Logged

Alons0
Tireless poster
****
Offline Offline

Bulgaria Bulgaria

Posts: 197



View Profile WWW Email
« Reply #4 on: May 11, 2007, 11:09:47 AM »

I'm sorry i cant help now, if you haven't sorted it out by tomorrow night, i will make it work. But its 1am and im sleeping Smiley
Are you free yet?
Logged

TSG
Operator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #5 on: May 11, 2007, 11:31:02 AM »

sorry Tongue nope its 2.29am i am just doing my quick forum check then heading to bed.
Logged

rejetto forum
« Reply #5 on: May 11, 2007, 11:31:02 AM »

Do you like this software? Consider even $2
 Logged
Alons0
Tireless poster
****
Offline Offline

Bulgaria Bulgaria

Posts: 197



View Profile WWW Email
« Reply #6 on: May 16, 2007, 09:56:30 AM »

sorry Tongue nope its 2.29am i am just doing my quick forum check then heading to bed.
I'm still waiting Roll Eyes
Logged

TSG
Operator
Insane poster
*****
Offline Offline

Australia Australia

Posts: 1919



View Profile WWW
« Reply #7 on: May 16, 2007, 11:02:38 AM »

<script  type="text/javascript">
function PopUp() {
   if (window.location.href == 'http://%host%/') {
      popup = window.open('','PopUp','height=325,width=490,resizable=yes,scrollable=yes');
      win = popup.document;
      win.write('<html><head><title>PopUp</title>');   
      win.write('<style>body{margin:0px;padding:0px;}</style></head><body>');
      win.write('<div>STUFF IN POPUP</div>');
      win.write('<div>STUFF IN POPUP</div>');
      win.write('</body></html>');
   } else {
      return null;
   }   
}
</script>

<body onload="PopUp();">

The above will run only if on the root of your server. Sorry for the delay i am REALLY busy lately.
Logged

Alons0
Tireless poster
****
Offline Offline

Bulgaria Bulgaria

Posts: 197



View Profile WWW Email
« Reply #8 on: May 16, 2007, 02:21:15 PM »

Thank you!
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 16, 2012, 01:54:06 AM
anything