?
Solved

About JavaScript

Posted on 1998-06-25
8
Medium Priority
?
180 Views
Last Modified: 2010-04-09
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.

0
Comment
Question by:aacosta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Expert Comment

by:fshakir
ID: 1844392
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>

0
 
LVL 1

Author Comment

by:aacosta
ID: 1844393
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.
0
 
LVL 1

Author Comment

by:aacosta
ID: 1844394
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:Holger101497
ID: 1844395
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...
0
 
LVL 1

Author Comment

by:aacosta
ID: 1844396
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.
0
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1844397
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>
0
 
LVL 6

Accepted Solution

by:
Holger101497 earned 600 total points
ID: 1844398
To close a window (can only be done if it was opened by JavaScript (or has only displayed one page so far)), you can just call windowreference.close().

This is just a little example (quickly done... no error checking (e.g. if the window is still open...)). Let me know if you need to know more...

<HTML>  <HEAD>
  <TITLE> </TITLE>

  <script language="JavaScript">
  <!--
  function wo() {ws=window.open('test.htm','MyWin','height=300,width=400');ws.focus(); //open and bring to front if open already
}

  function wc() {if (ws) ws.close();}    
  // -->
  </script>

</HEAD>
<BODY>
<a href='javaScript:wo()'>Open new window</a>
<a href='javaScript:wc()'>Close it</a>
</BODY>

</HTML>

Let me know if you have more questions...

Good luck,
Holger
0
 
LVL 1

Author Comment

by:aacosta
ID: 1844399
Thanks!, it`s working
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question