Link to home
Start Free TrialLog in
Avatar of jbajaj
jbajaj

asked on

javascript:poponload('main.htm');

I have two files
1.> main.html
2.> try-demo.html

From try-demo I am trying to open main.html. However I am getting an error in the javascript. Please evaluate my code below and let me know.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JavaScript Popup Example 3</title>
 
<script language="JavaScript1.2" type="text/javascript">
function poponload(url)
{
testwindow= window.open(url, "Stock Navigator","location=0,status=0,scrollbars=0,menubar=0,toolbar=0,width=1024,height=768,left=0 top=0 fullscreen=1");
}
</script>
</head>
<body>
<a href="javascript:poponload('main.htm');">Demo</a>
</body>
</html>

Open in new window

Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

Your parameter list is not fully comma separated.  Try this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JavaScript Popup Example 3</title>
 
<script language="JavaScript1.2" type="text/javascript">
function poponload(url)
{
testwindow= window.open(url, "Stock Navigator","location=0,status=0,scrollbars=0,menubar=0,toolbar=0,width=1024,height=768,left=0,top=0,fullscreen=1");
}
</script>
</head>
<body>
<a href="javascript:poponload('main.htm');">Demo</a>
</body>
</html>

Open in new window

Ok you forgot to include single quotes . And it should look like this


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JavaScript Popup Example 3</title>
 
<script language="JavaScript1.2" type="text/javascript">
 
 
function poponload(url)
{
window.open('url',null,
    "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
}
 
</script>
 
</head>
<body>
 
<a href="javascript:poponload();">Demo2</a>
 
</body>
</html>

Open in new window

Avatar of contactkarthi
as there menu and tool bars... replace the stocknavigator to null
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JavaScript Popup Example 3</title>
 
<script language="JavaScript1.2" type="text/javascript">
function poponload(url)
{
testwindow= window.open(url,null,"location=0,status=0,scrollbars=0,menubar=0,toolbar=0,width=1024,height=768,left=0 top=0 fullscreen=1");
}
</script>
</head>
<body>
<a href="javascript:poponload('main.htm');">Demo</a>
</body>
</html>

Open in new window

MY code is working just fine . Checked it a million times
>> erikTsomik

no need of single quote for url
>> contactkarthi

"Stock Navigator" is just the name given to this popup.  No need to null it.

The only problem with the original code above is the param list.
ASKER CERTIFIED SOLUTION
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

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
Thank you for the points