Run popup function from parent

A

aljamala

Hi,

I have a link for an employee directory search page. The link
(http://
xxxx/Search.aspx) works fine, however, I have another link to do an
Advanced Find.
From the search page, to do an advanced find, you click a link button

and its href is javascript:SEC38536A_OSA()

What I want to do is, open the search page and call this javascript
function automatically (since I am linking an advanced search)...how
is this possible?


I've tried something like this, but failed:


var newWind = window.open('http://atcit/Search.aspx', 'newWind');
newWind.SEC38536A_OSA();


Thanks in advance
 
D

Daz

Hi,

I have a link for an employee directory search page. The link
(http://
xxxx/Search.aspx) works fine, however, I have another link to do an
Advanced Find.


and its href is javascript:SEC38536A_OSA()

I'd recommend against that. What if the user can't use JavaScript, or
doesn't want to? It's often best to use the href attribute to link to
an HTML page, and use onclick to carry out a JavaScript function and
return false to prevent the browser from following the link if
JavaScript is enabled.
What I want to do is, open the search page and call this javascript
function automatically (since I am linking an advanced search)...how
is this possible?
I don't think I understand you correctly. Is it possible for you to
post an example?
 
D

Daz

Hi,

I have a link for an employee directory search page. The link
(http://
xxxx/Search.aspx) works fine, however, I have another link to do an
Advanced Find.


and its href is javascript:SEC38536A_OSA()

What I want to do is, open the search page and call this javascript
function automatically (since I am linking an advanced search)...how
is this possible?

I've tried something like this, but failed:

var newWind = window.open('http://atcit/Search.aspx', 'newWind');
newWind.SEC38536A_OSA();

Thanks in advance


Another thing that has just occurred to me, is that you might be
calling on the function before the window has fully loaded? I'm not
entirely sure if I am correct however, but you might want to look into
getting the child window to report to the parent when it's completely
loaded, before calling on the functions within it.
 
A

aljamala

From the search page, to do an advanced find, you click a link button


I'd recommend against that. What if the user can't use JavaScript, or
doesn't want to? It's often best to use the href attribute to link to
an HTML page, and use onclick to carry out a JavaScript function and
return false to prevent the browser from following the link if
JavaScript is enabled.
I agree with you there, since 10-15% of users do disable JavaScript.
However, this is an intranet site, and we all use JavaScript so that
is not a worry.
I don't think I understand you correctly. Is it possible for you to
post an example?
Sure...

Say I have two pages...parent.html and child.html

here is the parent:
<html>
<head>
<title>parent</title>
<script language="JavaScript">
var win;

function popup()
{
win = window.open("child.html", "test");
win.popup2();
}
</script>
</head>
<body>
<input type='button' value='parent click' onclick='popup()'>
</body>
</html>

here is the child:
<html>
<head>
<title>child</title>
<script language="JavaScript">
function popup2()
{
alert('true');
}
</script>
</head>
<body>
<input type='button' value='child click' onclick='popup2()'>
</body>
</html>


Basically I want to call open the child and call popup2 [in the child]
from the parent in one click.
 
A

aljamala

Another thing that has just occurred to me, is that you might be
calling on the function before the window has fully loaded? I'm not
entirely sure if I am correct however, but you might want to look into
getting the child window to report to the parent when it's completely
loaded, before calling on the functions within it.- Hide quoted text -

although I don't think that this is the problem, I think you were
heading in the right direction...I am actually not able to access the
JavaScript function (in http://atcit/Search.aspx) because I am calling
it from a different domain (http://efinfonet) which induces the cross-
domain script security restriction.
 
D

Daz

although I don't think that this is the problem, I think you were
heading in the right direction...I am actually not able to access the
JavaScript function (inhttp://atcit/Search.aspx) because I am calling
it from a different domain (http://efinfonet) which induces the cross-
domain script security restriction.


Aaah. That had occured to me, but I convinced myself that you would be
trying to access it from the same domain. There are lots of tutorials
around which show you how to use remote scripting to access data from
another website using hidden frames/iframes. I am not entirely sure if
this will help you with regards to accessing the script, however.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top