By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,821 Members | 1,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,821 IT Pros & Developers. It's quick & easy.

Run popup function from parent

P: n/a
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

Feb 1 '07 #1
Share this Question
Share on Google+
5 Replies

P: n/a
Daz
On Feb 1, 6:28 pm, aljam...@gmail.com wrote:
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()
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?
>
I've tried something like this, but failed:

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

Thanks in advance

Feb 1 '07 #2

P: n/a
Daz
On Feb 1, 6:28 pm, aljam...@gmail.com wrote:
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

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.

Feb 1 '07 #3

P: n/a
On Feb 1, 2:27 pm, "Daz" <cutenfu...@gmail.comwrote:
From the search page, to do an advanced find, you click a link button
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.
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.
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?
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.

Feb 1 '07 #4

P: n/a
On Feb 1, 2:33 pm, "Daz" <cutenfu...@gmail.comwrote:
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.
Feb 1 '07 #5

P: n/a
Daz
On Feb 1, 9:15 pm, aljam...@gmail.com wrote:
On Feb 1, 2:33 pm, "Daz" <cutenfu...@gmail.comwrote:
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 (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.

Feb 2 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.