Link to home
Start Free TrialLog in
Avatar of aacosta
aacosta

asked on

About JavaScript

I have this function:

<script language="JavaScript">
<!--
function OpenWindow() {

pagina="home.html";
var wnd="four11Kiosk";
var pagina="home.html"
var width='430';
var height='300';
var loc="/scripts/ale/pendientes.idc";
var myWindow = window.open(loc,

wnd,"resizable=yes,scrollbars=yes,width="+width+",height="+height);
return pagina;

}
-->
</script>

and I am calling it troughtout this command:

<a href="javascript:OpenWindow()"; return true;>Consultar TT</a>

So, I want to open a new browser in my client with a new page and open a new page in my original browser, how can I do it.

Thanks.

Avatar of fshakir
fshakir

Save yourself some javascript trouble.  Here is a smaller, easier to understand version:

in the home.html page, paste this in:

<body onload="window.open(/scripts/ale/pendientes.idc, four11Kiosk, resizable=yes, scrollbars=yes, width=430, height=300)"
</body>

Avatar of aacosta

ASKER

Yor are right, but at the time my browser is opening the page home.html it does does not finish loading the page, why?, the browser only open me a new browser with pendientes.idc

Thanks.
Avatar of aacosta

ASKER

Yor are right, but at the time my browser is opening the page home.html it does does not finish loading the page, why?, the browser only open me a new browser with pendientes.idc

Thanks.
Could you be more specific about waht the "original problem" was? Which part didn't work?
The "return true" seems strange... is it in any handler like onclick? Or just in the HTML code... the way you posted it, it won't work correctly...

You said: "and open a new page in my original browser"...
Where do you do that??`You need to call document.location.href='newpageformainwindow.html' as well...

IF you want "href='JavaScript:OpenWindow()'" to point to home.html, because that's the value your function returns, I have to disappoint you. You cannot use JavaScript-values that easily

Try this: <a href=&{OpenWindow()};>Consultar TT</a>
or this: <a href='home.html' onclick='OpenWindow()'>

Actually, the second way is better because it will work in nearly all brwosers - the first one is will only work in Netscape.

Let me know if that helped...
Avatar of aacosta

ASKER

Hello, thanks for your tips. Your are right, I used the second way and it worked!, Thanks, but I have another question, if you like answer me it and I will graded you :-).

After I open my windows with java script, can I close it from my original window? I mean:
I have windows1, it open a new windows2 (I have boths opened), can I close windows2 from windows1 with and event botton?.

Thanks.
just a little correction to fshakir's rejected answer:

<body onload="window.open('/scripts/ale/pendientes.idc', 'four11Kiosk', 'resizable=yes,scrollbars=yes,width=430,height=300')"
</body>
ASKER CERTIFIED SOLUTION
Avatar of Holger101497
Holger101497

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aacosta

ASKER

Thanks!, it`s working