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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script called from form not working..

Status
Not open for further replies.

MarkWilliamson

Programmer
Apr 1, 2002
34
US
I have a form with an INPUT TYPE = BUTTON control which calls a popup page to be displayed( my.asp ). The page displayed but I cannot display anything using the request.querystring. My input string is below and my asp is also included. Any suggestions would be greatly appreciated !!



<input type="BUTTON" Value="Select Name" Name=SelectDate OnClick="popup('MY.asp?SelectDate','pagename','640','480','center','front');">


MY.ASP
------

<%@ Language=VBScript %>

<html> <head>
</head>

<body bgcolor=FFFF00 link = 3300FF vlink = AA0000>


<% response.Write request.querystring %>



</body>
</html>



 
It is my Javascript function which displays the popup.

Code is below.


<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE="JAVASCRIPT">

<!--

var popupWindow=null;

function popup(mypage,myname,w,h,pos,infocus){

if (pos == 'random')

{leftpostion=(screen.width)?math.floor(math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} settings='width=' + w +',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizeable=no';popupWindow=window.open('',myname,settings);
if(infocus=='front'){popupWindow.focus();popupWindow.location=mypage;}
if(infocus=='back'){popupWindow.blur
();popupWindow.location=mypage;popupWindow.blur();}


}

// -->

</script>
 
Your popup function is deliberately made so much obscur for reading. I wonder why?

In any case,
[1] leftPostion, LeftPosition are not the same! js is case-sensitive.
[2] math object does not exist. It is Math.
[3] After setting up properly the var settings, you insert the line with window.open function.
[tt]
popupWindow=window.open("",myname,settings);
[/tt]
Nowhere I see this open() method. popupWindow remain null. What would it mean with something like null.location?
Though, I would prefer something like this
[tt]
popupWindow=window.open(mypage,myname,settings);
[/tt]
and spare later the popupWindow.location.

All in all, clean up your popup() function. (Mind the scope of those variables leftPosition etc... They are global as you scripted them. They are better local with var leftPosition type declaration.)
 
Ok, I see your window.open(). My remarks remain more or less the same.
 
Tsuji, thank you for your input.

The popup program works fine as far as displaying the page. My problem is that I cannot access the Request.querystring object in my ASP which is listed above.

Can you advise ?

Thanks for you help..
 
You seem not be convinced that the problem is your popup(). I have no magic. Why not do this for testing instead of having all those cosmetic.
[tt] <input type="BUTTON" Value="Select Name" Name=SelectDate OnClick="window.open('MY.asp?SelectDate');">
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top