iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old October 31st, 2007, 02:08 AM   #1
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
[SOLVED] How to make the PM pop up box?

I just can't stop thinking about this forum PM Pop-Up message box that indicate you have a Private Message (PM)!

Any idea how to make them (JS?, ASP?, PHP???)
Is it a "simple-to-do things"..???

Thanks..
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 31st, 2007, 12:38 PM   #2
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,802
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
Re: How to make the PM pop up box?

Javascript caused by a server side variable
The server side bit just says to do it,
the difficult part is the PM thing itself in JS.
This should be moved to JS section
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 31st, 2007, 09:03 PM   #3
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

Ok then, I'll move this thread to JS Forum!
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 31st, 2007, 09:10 PM   #4
Highly Reputable Member
 

Join Date: Apr 2007
Location: Willich, Germany
Age: 21
Posts: 592
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough
Re: How to make the PM pop up box?

OK, can you be a bit more specific about what you want help with.

Are you wondering how to know when to show the popup? Or how to animate it?
c010depunkk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 31st, 2007, 09:23 PM   #5
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

From my experience, I generally know that there is some code for checking if a certain field in my table database is new (when someone PM me, some field will be set to NEW), then the popup box will appear (with the animation)

pseudocode:

Code:
If recordset("newPm") = 'New' Then
   animate the popup box with the link to the new pm message
End If
Once they have read that, update the "newPm" field from "NEW" to "READ".
So, am I thinking creative enough?

Last edited by Monie; November 1st, 2007 at 01:53 AM..
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 1st, 2007, 06:16 AM   #6
Highly Reputable Member
 

Join Date: Apr 2007
Location: Willich, Germany
Age: 21
Posts: 592
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough
Re: How to make the PM pop up box?

yeah, that should work.
c010depunkk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 2nd, 2007, 01:26 AM   #7
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

I am having a bit problem with the javascript tho..
I mean how to do the animation things? It's javascript right?

Anybody can help me..?
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 2nd, 2007, 02:34 AM   #8
Highly Reputable Member
 

Join Date: Apr 2007
Location: Willich, Germany
Age: 21
Posts: 592
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough
Re: How to make the PM pop up box?

yes, it's javacript.....

Do you have any code yet?
c010depunkk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 2nd, 2007, 02:56 AM   #9
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

Not really. All still a bit blur to me.. but I get the idea, roughly not too sure..
My current idea...:

When someone post me a message(saved to myMessage field) and automatically set the myMessageElert field status to 'NEW'

there will be a IF Then Else function in my ASP page to check:

Code:
If myMessageElert = 'NEW' and user = session("user") Then
  animate popup box to elert user
End If
beyond that, I am blank
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 5th, 2007, 02:59 AM   #10
Reputable Member
 

Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 RohanShenoy is on a distinguished road
Re: How to make the PM pop up box?

I guess you would have include a server side script which would create a pop-up box when $unreadprivatemessages!=0
RohanShenoy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 5th, 2007, 03:10 AM   #11
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

Thanks for the info, but an example would be much better.
How does the page run the comparison code each time we have a new PM, does it refreshed? I don't think so, right?
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 5th, 2007, 04:04 AM   #12
Reputable Member
 

Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 RohanShenoy is on a distinguished road
Re: How to make the PM pop up box?

^monie, I don't know much because I am not an official programmer by qualification. Its just out of my curiosity.

About your question, I think logically, one would have to go about this way:
1. In the showthread.php, newthread.php, and index.php, there should be a code that indicates the table prefix and column name in MySQL database for unread private messages.

2. If the no. of unread private messages is not equal to zero, a javascript would be inserted in the page . The JS would contain confirm function and window.open function.
RohanShenoy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 5th, 2007, 04:12 AM   #13
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

Wow that's complicated!
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 5th, 2007, 06:12 AM   #14
Highly Reputable Member
SuperMember
 
Rakuli's Avatar
 

Join Date: Sep 2007
Location: Australia
Age: 25
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold
Re: How to make the PM pop up box?

Well actually it's not quite as complicated as all that.. lol

I don't know how the webforumz one actually works but this is what I would do....

In the head of your page, write with ASP or whatever
<script type="text/javascript">
If myMessageElert = 'NEW' and user = session("user") Then
// Write to page (not sure how with ASP
var showPMpopup = true;
Else
var showPMpopup = false;
End If
</script>

That would really be all that is needed from the server side (you can of course add more to make the PM popup more detailed, like the title of the PM and how many are new etc...

Then for the javascript.... This is very quickly thrown together and probably isn't as foolproof as the WFZ one....

Code:
<script type="text/javascript">
// Place this just below the </body> tag

if (showPMpopup)
{
    
document.write('<div style="width:300px;height:150px;border:solid 1px #000000;background-color:blue;position:absolute;top:-155px;left:100px;" id="PMpopup">PM Stuff here, you could write me without javascript or write me with ASP... this is as an example....<\/div>');

// now to animate the popup
// set some variables


function animatedPopup(varName)
{
    
this.variableName varName// Store the name of the variable for later reference
    
this.speed 5;// move everything every x milliseconds
    
this.pixelsPerMove 2// how many pixels to move from top eah time
    
this.finalPosFromTop 100// where will it stop from the top of the screen
    
this.horizontalMovement 6// how much pixel variation on each side?
    
this.currentHorizontalDirection 1// 1 = left, 0 = right
    
this.PMbox document.getElementById('PMpopup'); // the div for the popup box
    
    
this.startY =  !isNaN(parseInt(this.PMbox.style.top)) ? parseInt(this.PMbox.style.top) : 0// current X axis position, assume 0 if not set
    
this.startX = !isNaN(parseInt(this.PMbox.style.left)) ? parseInt(this.PMbox.style.left) : 0// current X axis position, assume 0 if not set
    
    
this.currentY this.startY;
    
this.currentX 0;
    
this.timeout false// the timeout holder
    
    
this.animatePopup = function () {
        
        if (
this.currentY >= this.finalPosFromTop)
        { 
// If the final Y position has been reached, set it at the final spot and exit
            
this.PMbox.style.top this.finalPosFromTop 'px';// move the last increment
            
return;
        } else 
            
this.PMbox.style.top this.currentY 'px'
        
        
// Now for the 'shaking' effect, don't move any further if we have reached our limit
        
if (Math.abs(this.currentX) < this.horizontalMovement)
            
this.PMbox.style.left = (this.startX this.currentX) + 'px';
        else if (
this.currentX 0)
            
this.currentHorizontalDirection 0// if we reached the limit in negative numbers, now we need to do positive
        
else
            
this.currentHorizontalDirection 1// If reached and positive, start heading back to the left
        
        // set up the movements
        
this.currentY += this.pixelsPerMove// the pixels from top
        
        // Now a randome movement left or right of the horizontal axis
        
this.currentX this.currentHorizontalDirection == this.currentX Math.round(Math.random() * 4) + this.currentX Math.round(Math.random() * 4) + 1;
        
        
// finally, set the timeout for the function to runagain
        
this.timeout setTimeout(this.variableName '.animatePopup()'this.speed);
    }
        
}
// Now the actual variable is set
var PMAnimator = new animatedPopup('PMAnimator');
// run the function after a second

setTimeout('PMAnimator.animatePopup()'1000);

}
</script> 
Works pretty well

** Rakuli grins cause it was easier than he thought **
__________________
Luke Dingle . com
Rakuli is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 6th, 2007, 03:56 AM   #15
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

Hai rakuli, Thanks for the code, just a simple question tho...

Code:
<script type="text/javascript">
If myMessageElert = 'NEW' and user = session("user") Then
  // Write to page (not sure how with ASP -> what should I do with this one? do you mean display something from the database or some message?
      var showPMpopup = true;
Else
      var showPMpopup = false;
End If
</script>
I'll try them tonight and let you know by tomorrow. If I success, a +rep point is waiting you
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 6th, 2007, 04:01 AM   #16
Highly Reputable Member
SuperMember
 
Rakuli's Avatar
 

Join Date: Sep 2007
Location: Australia
Age: 25
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold
Re: How to make the PM pop up box?

Actually write the literal string 'var showPMpopup = true;' with ASP...

The else write the same javascript variable as false so the literal string 'var showPMpopup = false'
__________________
Luke Dingle . com
Rakuli is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 6th, 2007, 04:16 AM   #17
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

Shouldn't that be in javascript code since it is in the <script type="text/javascript">? Just my curious..

If I am correct, I will declare showPMpopup as an ASP variable like this:

Code:
<script type="text/javascript">
Dim showPMpopup
If myMessageElert = 'NEW' and user = session("user") Then
  showPMpopup = true;
Else
  showPMpopup = false;
End If
</script>
I am right, am I? Just making sure I am in the right track so that I wont waste my time tonight trying them (no internet in my house, down for a while...)
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 6th, 2007, 04:26 AM   #18
Highly Reputable Member
SuperMember
 
Rakuli's Avatar
 

Join Date: Sep 2007
Location: Australia
Age: 25
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold
Re: How to make the PM pop up box?

Well, I have no idea what you do with ASP but let's say it was PHP

Code:
echo '<script type="text/javascript">';
if (
$newMessages true)
   echo 
'var showPMpopup = true;';
else
   echo 
'var showPMpopup = false;';
echo 
'</script>'
All you need to so is set the variable in ASP if there is a new message then write the appropriate javascript variable to the page.

Cheers,
__________________
Luke Dingle . com
Rakuli is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 6th, 2007, 04:38 AM   #19
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: How to make the PM pop up box?

"echo" means it will be printed/display in the page, am I right? or just a simple line of code..?
Do you mean I must write ASP code in Javascript..?

**monie tell himself to stop questioning! you should try them first before throwing any stupid, useless question!!

I'll get back to you tomorrow Rakuli. Thanks.
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 6th, 2007, 04:46 AM   #20
Highly Reputable Member
SuperMember
 
Rakuli's Avatar
 

Join Date: Sep 2007
Location: Australia
Age: 25
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold
Re: How to make the PM pop up box?

Echo means , write this to the page at this exact location... You shoule write javascript with ASP not vice versa....

eg.

HTML Code:
<html>
<head>
<title>Randomly Chosen</title>
<script type="text/javascript">

<%
/* ASP logic here that will print either 'var showPmpopup = false;' or 'var showPmpopup = true' */
%>
</script>
</head>
<body>
Whoe bunch of really cool stuff
<script type="text/javascript">
// Dump that entire load of code from my main code post here...
</script>
</body>
</html>
Cheers,
__________________
Luke Dingle . com
Rakuli is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to make an expand / collapse menu sing2trees JavaScript 4 April 14th, 2008 08:16 AM
[SOLVED] Problems with CSS 'Header Image' - How to make fluid?? slimboyfatz32 HTML, XHTML and CSS 5 January 28th, 2008 05:09 AM
[SOLVED] How to make a div a link R8515198 HTML, XHTML and CSS 4 November 30th, 2007 04:25 AM
[SOLVED] joining 2 queries together to make 1 query AdRock Databases 0 November 18th, 2007 05:37 PM
[SOLVED] How do I Make Content available for download chrissmith Your Design and Layout 4 November 11th, 2007 06:13 AM


Search Engine Optimization by vBSEO 3.2.0 RC8