Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AJAX popup variable passing issue 1

Status
Not open for further replies.

ralphonzo

Programmer
Apr 9, 2003
228
GB
I've found a lovely popup script that I'm using in an AJAX/ASP application. It works a treat, but won't seem to let me take it that extra step and use variable data in it. Here're the functions that set it up:

Code:
<script type='text/javascript'>
function myPopupRelocate() {
  var scrolledX, scrolledY;
  if( self.pageYOffset ) {
    scrolledX = self.pageXOffset;
    scrolledY = self.pageYOffset;
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    scrolledX = document.documentElement.scrollLeft;
    scrolledY = document.documentElement.scrollTop;
  } else if( document.body ) {
    scrolledX = document.body.scrollLeft;
    scrolledY = document.body.scrollTop;
  }

  var centerX, centerY;
  if( self.innerHeight ) {
    centerX = self.innerWidth;
    centerY = self.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    centerX = document.documentElement.clientWidth;
    centerY = document.documentElement.clientHeight;
  } else if( document.body ) {
    centerX = document.body.clientWidth;
    centerY = document.body.clientHeight;
  }

  var leftOffset = scrolledX + (centerX - 600) / 2;
  var topOffset = scrolledY + (centerY - 200) / 2;

  document.getElementById("styled_popup").style.top = topOffset + "px";
  document.getElementById("styled_popup").style.left = leftOffset + "px";
  document.getElementById("styled_popup").style.display = "block";
}
//fade functions
function setOpacity( value ) {
 document.getElementById("styled_popup").style.opacity = value / 10;
 document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 4 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 4 * i );
 }

 setTimeout('closeMyPopup()', 400 );
}

function closeMyPopup() {
 document.getElementById("styled_popup").style.display = "none"
}
//end fade

function fireMyPopup(conid) {
  setOpacity( 0 );
  myPopupRelocate();
  document.getElementById("styled_popup").style.display = "block";
  document.body.onscroll = myPopupRelocate;
  window.onscroll = myPopupRelocate;
  fadeInMyPopup();
}
</script>

and here's the popup display:

Code:
<div id='styled_popup' name='styled_popup' style='width: 680px; height: 300px; display:none; position: absolute;'>
<table width='680' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td><img height='23' width='656' src='images/x11_title.gif'></td>
<td><a href='javascript:fadeOutMyPopup();'><img height='23' width='24' src='images/x11_close.gif' border='0'></a></td>
</tr>
<tr><td colspan='2' bgcolor="#990033" style='background: url("images/x11_body.gif") top left; width: 680px; height: 277px;'>
POPUP CONTENT GOES HERE :o)
<script language="JavaScript">
document.write("CON ME: "+conid);
</script>
</td></tr>
</table>
</div>

here's the trigger code:

Code:
<input type='submit' value=' Fire ! ' onClick='fireMyPopup(<%=conkid(looper)%>)'>

'conkid(looper)' absolutely contains a value, but try as I might, I can't pick up the conid value, even though it's a global and contains the value at every other turn. Indeed, the 'document.write("CON ME: "+conid);' statement doesn't even print out the CON ME: element! I don't pretend to be very adept where JavaScript's concerned, but this is frying my head. Hopefully I'm just missing something fundamental, but any help would be greatly appreciated,

Ralph
 
I can't pick up the conid value, even though it's a global

Really? How would that be, given it's only ever defined as a parameter being passed into the "fireMyPopup" function?

On another note, where are you ever setting the content of the popup? It seems to never change.

Perhaps if you did make the "conid" variable truly global, then things might work for you? I'd make the following change to your "fireMyPopup" function to do this without too many changes:

Code:
function fireMyPopup(conidValue) {
   conid = conidValue;
   ...
}

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
'conid' is set as a variable in a seperate section outside of the functions. I didn't include that in the submitted code, but it is definately defined and initiated. I've implemented your idea, as follows:

Code:
function fireMyPopup(conidValue) {
  setOpacity( 0 );
  myPopupRelocate();
  document.getElementById("styled_popup").style.display = "block";
  document.body.onscroll = myPopupRelocate;
  window.onscroll = myPopupRelocate;
  fadeInMyPopup();
  conid = conidValue;
  alert(conid);
}

and 'conid' displays in the alert box, but only 'POPUP CONTENT GOES HERE :eek:)' shows up in the 'styled_popup':

Code:
<div id='styled_popup' name='styled_popup' style='width: 680px; height: 300px; display:none; position: absolute;'>
<table width='680' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td><img height='23' width='656' src='images/x11_title.gif'></td>
<td><a href='javascript:fadeOutMyPopup();'><img height='23' width='24' src='images/x11_close.gif' border='0'></a></td>
</tr>
<tr><td colspan='2' bgcolor="#990033" style='background: url("images/x11_body.gif") top left; width: 680px; height: 277px;'><!-- no-repeat -->
POPUP CONTENT GOES HERE :o)
<script language="JavaScript">
document.write("CON ME: "+conid);
</script>
</td></tr>
</table>
</div>

when it's run. Not even the 'CON ME:' doc.write. I just don't understand why the javascript element isn't working in the 'styled_popup' function.
 
Hi

What you are doing there looks definitely wrong.

Try if this gets you closer to what you want :
Code:
[b]function[/b] [COLOR=darkgoldenrod]fireMyPopup[/color][teal]([/teal]conid[teal])[/teal] [teal]{[/teal]
  [COLOR=darkgoldenrod]setOpacity[/color][teal]([/teal] [purple]0[/purple] [teal]);[/teal]
  [COLOR=darkgoldenrod]myPopupRelocate[/color][teal]();[/teal]
  [highlight]document[teal].[/teal][COLOR=darkgoldenrod]getElementById[/color][teal]([/teal][green][i]"styled_popup"[/i][/green][teal]).[/teal][COLOR=darkgoldenrod]getElementsByTagName[/color][teal]([/teal][green][i]'table'[/i][/green][teal])[[/teal][purple]0[/purple][teal]].[/teal]rows[teal][[/teal][purple]1[/purple][teal]].[/teal]cells[teal][[/teal][purple]0[/purple][teal]].[/teal]innerHTML[teal]=[/teal]conid[teal];[/teal][/highlight]
  document[teal].[/teal][COLOR=darkgoldenrod]getElementById[/color][teal]([/teal][green][i]"styled_popup"[/i][/green][teal]).[/teal]style[teal].[/teal]display [teal]=[/teal] [green][i]"block"[/i][/green][teal];[/teal]
  document[teal].[/teal]body[teal].[/teal]onscroll [teal]=[/teal] myPopupRelocate[teal];[/teal]
  window[teal].[/teal]onscroll [teal]=[/teal] myPopupRelocate[teal];[/teal]
  [COLOR=darkgoldenrod]fadeInMyPopup[/color][teal]();[/teal]
[teal]}[/teal]
If not, give us an URL to a publicly available copy of that page.

Feherke.
 
That's done the trick, thanks, but being cruddy with JavaScript, I'm struggling to include the content that I need. Is there a JS way of doing what I'm unsuccessfully trying here that'll work?

Code:
function fireMyPopup(conidValue) {
  conid = "<!--#include file='conkerdetail.asp'-->"+conidValue;
  setOpacity( 0 );
  myPopupRelocate();
  document.getElementById("styled_popup").getElementsByTagName('table')[0].rows[1].cells[0].innerHTML=conid;
  document.getElementById("styled_popup").style.display = "block";
  document.body.onscroll = myPopupRelocate;
  window.onscroll = myPopupRelocate;
  fadeInMyPopup();
  //alert(conid);
}

or will I need to bung all the code from the include file directly into the JS function?
 
conkerdetail.asp contains ASP, which is likely to execute before the javascript is it not? Bad idea?

The AJAX controls the asc/desc orders at the moment. I'm a server sider who's avoided JavaScript for years, and now it's coming back to bite me! I've been around so many gardens trying to figure out this popup thing now, that my thoughts are starting to become fuddled. I know I need to use AJAX again to call the contents of the include file (as there's a call to the DB). How or quite where I don't know. I feel as if I've tried everything (except the right choice obviously!!!).

Here's the AJAX, which drops down the elements in the desired order:

Code:
<script language="JavaScript">
var conid = 0;
var ascdesc = 0;
var targetzone = "zone";

function submitForm(role)
{ 
	var req = null; 
	var linky = "";
	if(conid > 0){
		ascdesc = role;
	}else if(ascdesc > 0){
		role = ascdesc;
	}else{
		ascdesc = 1;
		role = 1;
	}
	
	document.getElementById(targetzone).innerHTML = "Started...";	//"zone"

	if (window.XMLHttpRequest){
		req = new XMLHttpRequest();
		if (req.overrideMimeType){
			req.overrideMimeType('text/xml');
		}
	}else if (window.ActiveXObject){
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	req.onreadystatechange = function()
	{ 
		document.getElementById(targetzone).innerHTML = "Wait server...";
		if(req.readyState == 4){
			if(req.status == 200){
				document.getElementById(targetzone).innerHTML  = "" + req.responseText;	
			}else{
				document.getElementById(targetzone).innerHTML="Error: returned status code " + req.status + " " + req.statusText;
			}	
		} 
	}; 
	//targetzone = "zone";
	//alert(cid);
	//if(cid > 0){
		//linky = "conkerdetail.asp?role="+role+"&cid="+cid;
	//}else{
		linky = "conkerlist.asp?role="+role;
	//}
	req.open("GET", linky, true); 
	req.send(null); 
} 
</script>

The popup opens up from this to display each element's details. I had an idea that I could call the 'submitForm()' function again with a second parameter that utilises the detail content instead of the list content (hence the comments at the end), but this was prior to your reply, and I'm not sure I was on the right track anyway.
 
Hi

Ralph said:
conkerdetail.asp contains ASP, which is likely to execute before the javascript is it not?
That looks like an SSI directive. In which case, the output of the included file is inserted into the document by the web server, before delivering the page. That means far before the JavaScript can do anything.

Note that I know nothing about ASP, so I may be wrong.

Anyway, posting server-side codes not helps us to help you. As I mentioned, the URL of a publicly accessible copy of that page would be the best.


Feherke.
 
OK, I've got the scripts up onto a live server @ The only issue now is getting the content of conkerdetail.asp (which is a call to the database) to render into the popup via the 'styled_popup' function.
 
Hi

That looks almost done. Just add an [tt]id[/tt] to the [tt]td[/tt] inside the styled_popup in which you want the message to appear, then specify that [tt]id[/tt] as targetzone in fireMyPopup(). ( And of course, remove the assignment with my lengthy reference - the one I added & highlighted in my previous code. )

Then you will have to solve the passing of role. Just add it as another parameter to the fireMyPopup() call and set it when the [tt]submit[/tt] with the call is generated in ASP. ( By the way, I see no reason for [tt]submit[/tt], a simple [tt]button[/tt] seems appropriate. )

Feherke.
 
ralphonzo said:
'conid' is set as a variable in a seperate section outside of the functions. I didn't include that in the submitted code

Of course... because providing code that is related to the problem at hand is never a good idea!



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
OK, this is starting to do my fruit now (how about you??). Unfortunately I can only test on a local server at work, so I need to upload when I get back home.

I've implemented your recommendations (possibly incorrectly) and got no real joy. Can you have a scan and see what I've missed?

Code:
<script language="JavaScript">
var conid = 0;
var ascdesc = 0;
var targetzone = "zone";

function submitForm(role, cid)
{ 
	var req = null; 
	var linky = "";
	if(role > 0){
		ascdesc = role;
	}else if(ascdesc > 0){
		role = ascdesc;
	}else{
		ascdesc = 1;
		role = 1;
	}
	alert("cid: "+cid+" && targetzone: "+targetzone);
	document.getElementById(targetzone).innerHTML = "Started...";	//"zone"

	if (window.XMLHttpRequest){
		req = new XMLHttpRequest();
		if (req.overrideMimeType){
			req.overrideMimeType('text/xml');
		}
	}else if (window.ActiveXObject){
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	req.onreadystatechange = function()
	{ 
		document.getElementById(targetzone).innerHTML = "Wait server...";
		if(req.readyState == 4){
			if(req.status == 200){
				document.getElementById(targetzone).innerHTML  = "" + req.responseText;	
			}else{
				document.getElementById(targetzone).innerHTML="Error: returned status code " + req.status + " " + req.statusText;
			}	
		} 
	}; 
	targetzone = "zone";
	//alert(cid);
	if(cid > 0){
		linky = "conkerdetail.asp?role="+role+"&cid="+cid;
	}else{
		linky = "conkerlist.asp?role="+role;
	}
	req.open("GET", linky, true); 
	req.send(null); 
} 

function myPopupRelocate() {
  var scrolledX, scrolledY;
  if( self.pageYOffset ) {
    scrolledX = self.pageXOffset;
    scrolledY = self.pageYOffset;
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    scrolledX = document.documentElement.scrollLeft;
    scrolledY = document.documentElement.scrollTop;
  } else if( document.body ) {
    scrolledX = document.body.scrollLeft;
    scrolledY = document.body.scrollTop;
  }

  var centerX, centerY;
  if( self.innerHeight ) {
    centerX = self.innerWidth;
    centerY = self.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    centerX = document.documentElement.clientWidth;
    centerY = document.documentElement.clientHeight;
  } else if( document.body ) {
    centerX = document.body.clientWidth;
    centerY = document.body.clientHeight;
  }

  var leftOffset = scrolledX + (centerX - 600) / 2;
  var topOffset = scrolledY + (centerY - 200) / 2;

  document.getElementById("styled_popup").style.top = topOffset + "px";
  document.getElementById("styled_popup").style.left = leftOffset + "px";
  document.getElementById("styled_popup").style.display = "block";
}
//fade functions
function setOpacity( value ) {
 document.getElementById("styled_popup").style.opacity = value / 10;
 document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 4 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 4 * i );
 }

 setTimeout('closeMyPopup()', 400 );
}

function closeMyPopup() {
 document.getElementById("styled_popup").style.display = "none"
}
//end fade

function fireMyPopup(conidValue) {
  conid = conidValue;
 // alert(conid);
  setOpacity( 0 );
  myPopupRelocate();
  document.getElementById("styled_popup").style.display = "block";
  //document.getElementById("styled_popup").getElementsByTagName('table')[0].rows[1].cells[0].innerHTML=conidValue;
  document.body.onscroll = myPopupRelocate;
  window.onscroll = myPopupRelocate;
  fadeInMyPopup();
  targetzone = "firezone";
  submitForm(role,conid);
}
</script>

and the target:

Code:
<div id='styled_popup' name='styled_popup' style='width: 380px; height: 300px; display:none; position: absolute;'>
<table width='380' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td><img height='23' width='356' src='images/x11_title.gif'></td>
<td><a href='javascript:fadeOutMyPopup();'><img height='23' width='24' src='images/x11_close.gif' border='0'></a></td>
</tr>
<tr><td colspan='2' bgcolor="#990033" style='background: url("images/x11_body.gif") no-repeat top left; width: 380px; height: 277px;'>
<div id="targetzone">
POPUP CONTENT GOES HERE :o)
</div>
</td></tr>
</table>
</div>

I just can't figure out how to get the content to display in the popup. Am I being dumb?

Thanks for all your time by the way, I really appreciate it,

Ralph
 
Hi

Code:
[small][b]<div[/b] [maroon]id[/maroon][teal]=[/teal][green][i]'styled_popup'[/i][/green] [maroon]name[/maroon][teal]=[/teal][green][i]'styled_popup'[/i][/green] [maroon]style[/maroon][teal]=[/teal][green][i]'width: 380px; height: 300px; display:none; position: absolute;'[/i][/green][b]>[/b]
[b]<table[/b] [maroon]width[/maroon][teal]=[/teal][green][i]'380'[/i][/green] [maroon]cellpadding[/maroon][teal]=[/teal][green][i]'0'[/i][/green] [maroon]cellspacing[/maroon][teal]=[/teal][green][i]'0'[/i][/green] [maroon]border[/maroon][teal]=[/teal][green][i]'0'[/i][/green][b]>[/b]
[b]<tr>[/b]
[b]<td><img[/b] [maroon]height[/maroon][teal]=[/teal][green][i]'23'[/i][/green] [maroon]width[/maroon][teal]=[/teal][green][i]'356'[/i][/green] [maroon]src[/maroon][teal]=[/teal][green][i]'images/x11_title.gif'[/i][/green][b]></td>[/b]
[b]<td><a[/b] [maroon]href[/maroon][teal]=[/teal][green][i]'javascript:fadeOutMyPopup();'[/i][/green][b]><img[/b] [maroon]height[/maroon][teal]=[/teal][green][i]'23'[/i][/green] [maroon]width[/maroon][teal]=[/teal][green][i]'24'[/i][/green] [maroon]src[/maroon][teal]=[/teal][green][i]'images/x11_close.gif'[/i][/green] [maroon]border[/maroon][teal]=[/teal][green][i]'0'[/i][/green][b]></a></td>[/b]
[b]</tr>[/b]
[b]<tr><td[/b] [maroon]colspan[/maroon][teal]=[/teal][green][i]'2'[/i][/green] [maroon]bgcolor[/maroon][teal]=[/teal][green][i]"#990033"[/i][/green] [maroon]style[/maroon][teal]=[/teal][green][i]'background: url("images/x11_body.gif") no-repeat top left; width: 380px; height: 277px;'[/i][/green][b]>[/b][/small]
[b]<div[/b] [maroon]id[/maroon][teal]=[/teal][green][i]"[highlight]firezone[/highlight]"[/i][/green][b]>[/b]
POPUP CONTENT GOES HERE :o)
[b]</div>[/b]
[small][b]</td></tr>[/b]
[b]</table>[/b]
[b]</div>[/b][/small]

Feherke.
 
That'll be me being dumb then! I may be being dumb again here, but it's still not pulling the info into the popup. I put the alert into the submitForm function to see whether it was being called from the fireMyPopup function or not - not! Again, am I being dumb?
 
Hi

Feherke said:
Then you will have to solve the passing of role. Just add it as another parameter to the fireMyPopup() call and set it when the submit with the call is generated in ASP. ( By the way, I see no reason for submit, a simple button seems appropriate. )
Code:
[b]function[/b] [COLOR=darkgoldenrod]fireMyPopup[/color][teal]([/teal][highlight]role[teal],[/teal][/highlight]conidValue[teal])[/teal] [teal]{[/teal]
[small]  conid [teal]=[/teal] conidValue[teal];[/teal]
 [gray]// alert(conid);[/gray]
  [COLOR=darkgoldenrod]setOpacity[/color][teal]([/teal] [purple]0[/purple] [teal]);[/teal]
  [COLOR=darkgoldenrod]myPopupRelocate[/color][teal]();[/teal]
  document[teal].[/teal][COLOR=darkgoldenrod]getElementById[/color][teal]([/teal][green][i]"styled_popup"[/i][/green][teal]).[/teal]style[teal].[/teal]display [teal]=[/teal] [green][i]"block"[/i][/green][teal];[/teal]
  [gray]//document.getElementById("styled_popup").getElementsByTagName('table')[0].rows[1].cells[0].innerHTML=conidValue;[/gray]
  document[teal].[/teal]body[teal].[/teal]onscroll [teal]=[/teal] myPopupRelocate[teal];[/teal]
  window[teal].[/teal]onscroll [teal]=[/teal] myPopupRelocate[teal];[/teal]
  [COLOR=darkgoldenrod]fadeInMyPopup[/color][teal]();[/teal]
  targetzone [teal]=[/teal] [green][i]"firezone"[/i][/green][teal];[/teal][/small]
  [COLOR=darkgoldenrod]submitForm[/color][teal]([/teal]role[teal],[/teal]conid[teal]);[/teal]
[teal]}[/teal]
Code:
[small][b]<div[/b] [maroon]id[/maroon][teal]=[/teal][green][i]'styled_popup'[/i][/green] [maroon]name[/maroon][teal]=[/teal][green][i]'styled_popup'[/i][/green] [maroon]style[/maroon][teal]=[/teal][green][i]'width: 380px; height: 300px; display:none; position: absolute;'[/i][/green][b]>[/b]
[b]<table[/b] [maroon]width[/maroon][teal]=[/teal][green][i]'380'[/i][/green] [maroon]cellpadding[/maroon][teal]=[/teal][green][i]'0'[/i][/green] [maroon]cellspacing[/maroon][teal]=[/teal][green][i]'0'[/i][/green] [maroon]border[/maroon][teal]=[/teal][green][i]'0'[/i][/green][b]>[/b]
[b]<tr>[/b]
[b]<td><img[/b] [maroon]height[/maroon][teal]=[/teal][green][i]'23'[/i][/green] [maroon]width[/maroon][teal]=[/teal][green][i]'656'[/i][/green] [maroon]src[/maroon][teal]=[/teal][green][i]'images/x11_title.gif'[/i][/green][b]></td>[/b]
[b]<td><a[/b] [maroon]href[/maroon][teal]=[/teal][green][i]'javascript:fadeOutMyPopup();'[/i][/green][b]><img[/b] [maroon]height[/maroon][teal]=[/teal][green][i]'23'[/i][/green] [maroon]width[/maroon][teal]=[/teal][green][i]'24'[/i][/green] [maroon]src[/maroon][teal]=[/teal][green][i]'images/x11_close.gif'[/i][/green] [maroon]border[/maroon][teal]=[/teal][green][i]'0'[/i][/green][b]></a></td>[/b]
[b]</tr>[/b]
[b]<tr><td[/b] [maroon]colspan[/maroon][teal]=[/teal][green][i]'2'[/i][/green] [maroon]bgcolor[/maroon][teal]=[/teal][green][i]"#990033"[/i][/green] [maroon]style[/maroon][teal]=[/teal][green][i]'background: url("images/x11_body.gif") no-repeat top left; width: 380px; height: 277px;'[/i][/green][b]>[/b]
POPUP CONTENT GOES HERE :o)
[b]<script[/b] [maroon]language[/maroon][teal]=[/teal][green][i]"JavaScript"[/i][/green][b]>[/b]
document.write("CON ME: "+conid);
[b]</script>[/b]
[b]</td></tr>[/b]
[b]</table>[/b]
[b]</div>[/b]
1[b]<br>[/b]SELECT * FROM conkerlist ORDER BY conkrank DESC
	[b]<table[/b] [maroon]border[/maroon][teal]=[/teal][green][i]'0'[/i][/green] [maroon]cellspacing[/maroon][teal]=[/teal][green][i]'2'[/i][/green] [maroon]cellpadding[/maroon][teal]=[/teal][green][i]'4'[/i][/green][b]>[/b]
	[b]<tr><td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]ID[b]</td>[/b]
	[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Conker Name[b]</td>[/b]
	[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Battles[b]</td>[/b]
	[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Rank(er)[b]</td>[/b]
	[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Strength*[b]</td>[/b]
	[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Look[b]</td>[/b]
	[b]<td>[/b]Details[b]</td></tr>[/b]
		[b]<tr><td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]3[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Upandcomer[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]7[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]3[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]99[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]9[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]
		[b]<div[/b] [maroon]id[/maroon][teal]=[/teal][green][i]"firezone"[/i][/green][b]>[/b][/small]
		 [b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]'submit'[/i][/green] [maroon]value[/maroon][teal]=[/teal][green][i]' Fire ! '[/i][/green] [maroon]onClick[/maroon][teal]=[/teal][green][i]'fireMyPopup([highlight]1,[/highlight]3)'[/i][/green][b]>[/b]
[small]		[b]</div></td></tr>[/b]
		[b]<tr><td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]2[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]Ben's Biffer[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]8[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]2[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]89[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]7[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]
		[b]<div[/b] [maroon]id[/maroon][teal]=[/teal][green][i]"firezone"[/i][/green][b]>[/b][/small]
		 [b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]'submit'[/i][/green] [maroon]value[/maroon][teal]=[/teal][green][i]' Fire ! '[/i][/green] [maroon]onClick[/maroon][teal]=[/teal][green][i]'fireMyPopup([highlight]1,[/highlight]2)'[/i][/green][b]>[/b]
[small]		[b]</div></td></tr>[/b]
		[b]<tr><td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]1[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]The Chestnut Avenger[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]13[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]1[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]97[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]8[b]</td>[/b]
		[b]<td[/b] [maroon]class[/maroon][teal]=[/teal][green][i]'borderlais'[/i][/green][b]>[/b]
		[b]<div[/b] [maroon]id[/maroon][teal]=[/teal][green][i]"firezone"[/i][/green][b]>[/b][/small]
		 [b]<input[/b] [maroon]type[/maroon][teal]=[/teal][green][i]'submit'[/i][/green] [maroon]value[/maroon][teal]=[/teal][green][i]' Fire ! '[/i][/green] [maroon]onClick[/maroon][teal]=[/teal][green][i]'fireMyPopup([highlight]1,[/highlight]1)'[/i][/green][b]>[/b]
[small]		[b]</div></td></tr>[/b]
	[b]</table>[/b][/small]
Note that the output of conkerlist.asp is not displayed as a HTML document, it is inserted as a piece into an existing document. So do not format it as a whole HTML document, just as a piece of HTML document.

Feherke.
 
OK, now I'm getting it! The alternate doc opens up now as hoped, but it doesn't open in the popup. It's close now though...
 
Hi

In the [tt]function[/tt] submitForm() you are setting [tt]targetzone [teal]=[/teal] [green]"zone"[/green][teal];[/teal][/tt]. So the [tt]onreadystatechange[/tt] event handler will overwrite [tt]div[/tt] zone's [tt]innerHTML[/tt]. And while [tt]div[/tt] styled_popup was descendant of [tt]div[/tt] zone, it vanishes.

Ralph, your way to organize your code is very hard to follow for me. Debugging it takes too much time. Sorry if I will have to lower the priority of helping you.


Feherke.
 
OK, I see 'targetzone = "zone";' problem, so I've moved it to the end of the function. It needs to be in there so that I can target multiple IDs with the same submitForm() function. The popup shows again now, but with no targetted info. I've managed to find an outward facing server in this place:
I hear what you're saying about my code orgainisation. I won't really understand how everything works until it does, so I'm stuck with it at the moment I'm afraid. Are you suggesting however that there may be a much more efficient process here?

As I am new to, and painfully inadept with the mechanics of AJAX (and dreadfully rusty with JavaScript), I'm feeling quite guilty at taking up your time. Please draw the line if you can't spare any more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top