SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2006
    0 Post(s)
    0 Thread(s)

    Pop-up script with a variable from parent form

    Here is a neat little popup window script I like to use.

    <script language="javascript" type="text/javascript">
    var newwindow = '';
    function popitup_deletecounty(url) {
    	if (!newwindow.closed && newwindow.location) {
    		newwindow.location.href = url;
    	else {,'deletecounty','height=200,width=250, left=230, top=348');
    		if (!newwindow.opener) newwindow.opener = self;
    	if (window.focus) {newwindow.focus()}
    	return false;
    // -->
    The html href looks like this

    PHP Code:
    <a href="/dataservices/geoeval_deletecounty.php?pjid=<?php echo $Request_ID;?>&id=<?php echo $Site_ID;?>&geid=<?php echo $GE_ID;?>"
    onClick="return popitup_deletecounty('/dataservices/geoeval_deletecounty.php?pjid=<?php echo $Request_ID;?>&id=<?php echo $Site_ID;?>&geid=<?php echo $GE_ID;?>')" 
    name="deletecounty" > delete </a>
    Can someone help me use the name attribute of the href in the javascript function, ie.

    function popitup_namevariable(url)?

    I'd like to make the script generic so I can just use it as a source instead of the whole thing and so I can use it multiple times in the same page with different links.

    I am new at this so if anyone can give me some pointers it would be much appreciated.

    Can someone help me to use t

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    0 Post(s)
    0 Thread(s)
    like this?:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
    		<title>Untitled Page</title>
    		<script type="text/javascript"><!--
    function newWin(myLink) {
    	var winName = "window_" +;
    	var winUrl = myLink.href;
    	if (document[winName]) {
    		if (document[winName].location != winUrl) document[winName].location.href = winUrl;
    	} else {
    		document[winName] =,winName,'height=200,width=250, left=230, top=348');
    		if (document[winName].opener) document[winName].opener = self;
    	if (window.focus) document[winName].focus();
    	return false;
    		<a href="" onclick="newWin(this); return false;" name="googleWindow">Click</a>
    		<a href="" onclick="newWin(this); return false;" name="yahooWindow">Click</a>
    		<a href="" onclick="newWin(this); return false;" name="wiredWindow">Click</a>
    Last edited by funkdaddy; Jan 24, 2007 at 14:24. Reason: added location checking for old windows


Posting Permissions

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