Forum moderator: bigblog  
uCoz Community » For Webmasters » Custom Solutions » 2 Automatic AJAX window on webpage load (Tutorial)
2 Automatic AJAX window on webpage load
CodeResolution
Posts: 1570
Reputation: 58

Message # 1 | 3:06 PM
I wrote the following codes where customised by myself. However their sources belong to their rightful owners, DO NOT claim them as your own work. Both scripts have been tested and work.

1. Automatic AJAX window in center of page
Place the following script between the header tags.
Code
<script type="text/javascript">
window.onload = function ajaxauto(){
var ajax_data = 'content goes here'; new _uWnd('myname','title',300,350,{shadow:1,autosize:1,modal:0,close:1},ajax_data);}
</script>


2. Automatic AJAX window in bottom right of your page
Place the following script between the header tags.
Code
<script type="text/javascript">
window.onload = function ajaxbtm() {_uWnd.alert('Content goes here','Title',{w:500,h:100,tm:10000});}
</script>


'Content goes here' - The content
'Title' - The title
300,350 / w:500,h:100 - The size measured in pixels (px)
tm:10000 - Duration before window closes

More info - http://forum.ucoz.com/forum/36-8296-43813-16-1255606466

Kind regards,
Elliott.

"The best uCoz" critic since 2007.
Qualified website, branding, print & user interface designer.

I'm on Behance and Twitter.
Aloyasha
Posts: 75
Reputation: 2

Message # 2 | 3:23 PM
2 Questions
--------------------

#1
How do you make it so it disappears like normally on itself?


2#
How can I make it so it ask Guest to join?


Nice Thread biggrin Thanks In Advance.



Click^-^
CodeResolution
Posts: 1570
Reputation: 58

Message # 3 | 3:33 PM
#1. I've edited the thread, the second AJAX window is the only one available for a time before it closes.

#2. In the content area place the following:

Code
Make sure to <a href="$REGISTER_LINK$">Regsiter</a> or <a href="$LOGIN_LINK$">Login</a>

Kind regards,
Elliott.

"The best uCoz" critic since 2007.
Qualified website, branding, print & user interface designer.

I'm on Behance and Twitter.
Post edited by CreativeCollusions - Sunday, 2011-01-02, 1:40 PM
Aloyasha
Posts: 75
Reputation: 2

Message # 4 | 3:57 PM
Thanks CreativeCollusions, You Are A True uCozer. : )

Click^-^
FuriousAngels
Posts: 28
Reputation: 0

Message # 5 | 5:48 PM
CreativeCollusions, I am having a problem. I have set a page to personal template, than put your code in my header. Yield no results however, I am not sure what thelittle thing I am missing is however I know it must be silly.

You see my code:

Code

<script type="text/javascript">  
window.onload = function ajax(){  
var ajax_data = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"  
WIDTH=500 HEIGHT=281>  
  <PARAM NAME=movie VALUE="/flashobjects/fa.swf">  
<PARAM NAME=menu VALUE=false>  
<PARAM NAME=quality VALUE=high>  
<PARAM NAME=wmode VALUE=opaque>  
<PARAM NAME=scale VALUE=noscale>  
  <EMBED src=/flashobjects/fa.swf menu=false quality=high wmode=opaque  
scale=noscale WIDTH=500 HEIGHT=281 TYPE="application/x-shockwave-flash"  
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">  
</EMBED>  
  </OBJECT>'; new _uWnd('myname','Join our Community!',500,281,{shadow:1,autosize:1,modal:0,close:1},ajax_data);}  
</script>

and than, to test my theories I simply copied your alert window code to my header and yielded no results.

Code

     <script type="text/javascript">  
window.onload = function ajax-bottom() {_uWnd.alert('Content goes here','Title',{w:500,h:100,tm:1000});}  
</script>

I hope you can help me understand where my fault is!

Goblok
Posts: 6
Reputation: 0

Message # 6 | 4:35 PM
1. if i use this code, ucoz system can block my website? i hear some issues this code can block my website
2. can i change ajax window to black/other colors?

no adult get baby
CodeResolution
Posts: 1570
Reputation: 58

Message # 7 | 6:07 PM
FuriousAngels, please provide the link to your website.

Goblok,
1) no this will not block your website.
2) There are several colours you can use. You can access these colours via the admin bar.


Kind regards,
Elliott.

"The best uCoz" critic since 2007.
Qualified website, branding, print & user interface designer.

I'm on Behance and Twitter.
FuriousAngels
Posts: 28
Reputation: 0

Message # 8 | 7:22 PM
CreativeCollusions,

http://www.furiousreplays.com

Sorry for the delay, hate to have you post another message since your at such a unique number as it is. I will be private messaging you in hopes to hear from you sooner. Thanks!

CoffeeCone
Posts: 687
Reputation: 41

Message # 9 | 1:09 PM
FuriousAngels,
Quote (FuriousAngels)
and than, to test my theories I simply copied your alert window code to my header and yielded no results.

Code
<script type="text/javascript">   
window.onload = function ajax-bottom() {_uWnd.alert('Content goes here','Title',{w:500,h:100,tm:1000});}   
</script>

I hope you can help me understand where my fault is!


I tried that code and I managed to get the function called if you change ajax-bottom to something else, try testfunct which stands for test function. That did the trick for me.

"Friends don't let friends use Internet Explorer 6." - Microsoft || Join the cause. Help your friends.


CodeResolution
Posts: 1570
Reputation: 58

Message # 10 | 5:49 PM
FuriousAngels, not a problem. Since your using a personal template you may have to add the jQuery and CSS files manually. It's very simple. Make a backup copy of your website template first, just in case you make a mistake.
Place the script below between your head tags, and then the script you want (provided in the main thread), also in between the head tags.
Code
<link type="text/css" rel="StyleSheet" href="http://s29.ucoz.net/src/layer1.css" /><script type="text/javascript" src="http://s29.ucoz.net/src/u.js"></script>

Kind regards,
Elliott.

"The best uCoz" critic since 2007.
Qualified website, branding, print & user interface designer.

I'm on Behance and Twitter.
FuriousAngels
Posts: 28
Reputation: 0

Message # 11 | 6:15 AM
CreativeCollusions, I forgot to mention this didnt work sad

Added (2011-01-17, 0:15 Am)
---------------------------------------------
CreativeCollusions, I forgot to mention this didnt work sad

CodeResolution
Posts: 1570
Reputation: 58

Message # 12 | 8:01 AM
FuriousAngels, did you try this and this?
Kind regards,
Elliott.

"The best uCoz" critic since 2007.
Qualified website, branding, print & user interface designer.

I'm on Behance and Twitter.
Blazer
Posts: 310
Reputation: 25

Message # 13 | 2:53 PM
Quote (CreativeCollusions)
Place the following script between the and tags.
what tags ? head ?

If i helped you + My Reputation and Give me an Award.
Paradox
Old Guard
Posts: 3284
Reputation: 145

Message # 14 | 3:01 PM
Blazer, from what I know you can place either code anywhere on your page as long as any of the code is within the script tags.

Hope this helps happy

Jack of all trades in development, design, strategy.
Working as a Support Engineer.
Been here for 13 years and counting.
CodeResolution
Posts: 1570
Reputation: 58

Message # 15 | 4:01 PM
Blazer, between the header tags is what it was supposed to be:
Code
<head></head>

Kind regards,
Elliott.

"The best uCoz" critic since 2007.
Qualified website, branding, print & user interface designer.

I'm on Behance and Twitter.
uCoz Community » For Webmasters » Custom Solutions » 2 Automatic AJAX window on webpage load (Tutorial)
Search: