Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2004
    Location
    Kansas
    Posts
    86
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question JavaScript PopUp Problem

    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
    Code:
    <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
    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!
    Last edited by Ryltar; 12-21-2004 at 02:41 PM.

  • #2
    New Coder
    Join Date
    Nov 2004
    Location
    Kansas
    Posts
    86
    Thanks
    2
    Thanked 0 Times in 0 Posts
    And sorry this is so unspecific... I am not a JavaScript person...

  • #3
    New Coder
    Join Date
    Nov 2004
    Location
    Kansas
    Posts
    86
    Thanks
    2
    Thanked 0 Times in 0 Posts
    OK... got it fixed and working...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •