View Full Version : What have I done wrong?


iTom
11-22-2005, 05:25 PM
I'm working on this code for my website and ProBoards, but what have I done wrong??? Please help me. Thanks.

<script type="text/javascript">

// New PM alert and PM viewer.
//
// Designed by Thomas Oldbury,
// thomas@tgohome.com and
// Gryphon Lands.
// (http://gryphonlands.proboards79.com/)
//
// This header MUST stay intact
// for legal use.

// Customise the message, new denotes the amount of PMs so leave that there.
var message = "You have " +new+ " PM/'s. Click OK to view your PM/'s. ";

// your username

var username = "USERNAME";

// your proboards number (example: 77 is if your url is: username.proboards77.com) (http://username.proboards77.com)/)

var num = "77";

// custom title for PM popup if OK is clicked (if un-needed, leave blank)

var title = "";

// no need to change this...

var url = host + "index.cgi?action=pm";
var host = username + "proboards" + num + ".com";
var types = "width=800,height=600,toolbar,location,status,scrol lbars,menubar,resizable";

function runPmCheck()
{
var new = (td[2].innerHTML.match(/<\/a>, (.+?) new/i)) ? RegExp.$1: ''; /* grab the amount of PM's */
if(new > 0)
{
if(confirm(message))
{
if(!window.open(url,title,types))
{
alert("Unable to launch popup! /n/nThis may be because of a popup blocker. /n/nPlease use the link on the forum. ");
}

}
}
}

runPmCheck();
</script>


see on: http://scripts4u.proboards80.com/ (http://scripts4u.proboards80.com/)

thanks.

harmor
11-23-2005, 12:09 AM
try it without "var"

iTom
11-23-2005, 10:34 AM
huh?

G-commer
11-28-2005, 01:19 AM
You are defining your variables to soon.
When you defined the variable "message":

var message = "You have " +new+ " PM/'s. Click OK to view your PM/'s. ";

You had not defined the variable "new" yet.
Also:
When you defined the variable "url":

var url = host + "index.cgi?action=pm";

the variable "host" had not yet been defined.
Along with:
var host = username + "proboards" + num + ".com";
which should be:
var host = username + ".proboards" + num + ".com";


There are probably a few more problems but this should help.