...

View Full Version : JavaScript PopUp Problem



Ryltar
12-21-2004, 02:38 PM
Hi, I am trying to write a news type page where you click the read more link and it will pop up a new window with the full article in it.
I use this to set the link


<div class = 'announcementDetail'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Today was the project exam. We took our Bot down to the small gym and drove it. Most of the students in the class drove the Bot. We found out that ...&nbsp;<a class = 'readmore' href = '#' onClick = "popup( 'viewannouncement.php?title=Exam Day&date=December 16, 2004&content=Today was the project exam. We took our Bot down to the small gym and drove it. Most of the students in the class drove the Bot. We found out that the motors turn at different velocities and will have to be recalibrated. Also more batteries will be needed. We were ran out of juice after about 10-20 minutes of driving and needed to use the secondary batteries. These batteries were not fully charged and ran out fast. So we had a lot of waiting for batteries to charge.', 'Announcement Detail', 690, 360 )">More</a> </div>


And this is my JavaScript code


IE = navigator.appName == "Microsoft Internet Explorer";
NS = navigator.appName == "Netscape";
bVer = parseInt( navigator.appVersion );

var newWin = null;

function popup( loc, name, width, height ) {

var _params = "width = " + width + ", height = " + height + ", resizable = yes, status = no, toolbar = no, scrollbars = yes";

// Center on browsers which support JavaScript 1.2
if ( bVer >= 4 ) {

var _left = ( ( ( screen.width - width ) ) >> 1 );
var _top = ( ( ( screen.height - height ) ) >> 1 );

}

if ( IE ) {

_params += ",top=" + _top + ",left=" + _left;

} else if ( NS ) {

_params += ",screenX=" + _left + ",screenY=" + _top;

}

newWin = window.open( loc, name, _params );

if ( newWin != null && !( IE && bVer < 5 ) ) {// MSIE4 doesn't focus windows

newWin.focus( );

}

}


I get an Invalid Argument error when I click the link... Could someone please help me!

Ryltar
12-21-2004, 03:21 PM
And sorry this is so unspecific... I am not a JavaScript person... :o

Ryltar
12-21-2004, 03:34 PM
OK... got it fixed and working...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum