jamesh1031
asked on
I want to pop up a window on my computer from a .htm page. What is the reference and/or syntax?
I have an .htm page open from my local computer.
I can add links to other pages, but I don't know how to create a popup window graphic link from my local computer.
I found this and tried it...
<a href="newwindow.htm" onClick="window.open('samp lewindow.h tm', 'NewButtonWindowName','wid th=375,hei ght=250')" ><img src="button.gif" alt="AlternateText Description" </a>
I am confused with the references. I am on let's say page1.htm I want to open page2.htm page1.htm is in a folder called maintenance and I want to open page2.htm which is in a folder called help, so I think it is ../help/page2.htm I am going to use a button from ../images
What do you think they are asking for in place of newwindow.htm samplewindow.htm and newbuttonwindowname ?
Any help would be appreciated.
I can add links to other pages, but I don't know how to create a popup window graphic link from my local computer.
I found this and tried it...
<a href="newwindow.htm" onClick="window.open('samp
I am confused with the references. I am on let's say page1.htm I want to open page2.htm page1.htm is in a folder called maintenance and I want to open page2.htm which is in a folder called help, so I think it is ../help/page2.htm I am going to use a button from ../images
What do you think they are asking for in place of newwindow.htm samplewindow.htm and newbuttonwindowname ?
Any help would be appreciated.
Sorry. Submitted too soon ;-)
In your case, you want to replace 'samplewindow.htm' with ../help/page2.htm.
If you want to remain on the same "main" page in the browser, you can just remove the href="newwindow.htm" to leave <a onClick...
In your case, you want to replace 'samplewindow.htm' with ../help/page2.htm.
If you want to remain on the same "main" page in the browser, you can just remove the href="newwindow.htm" to leave <a onClick...
If you want lots more detail, see : http://tech.irt.org/articles/js128/index.htm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
to customize your new window that will pop-up you can modify the code of the javaScript function I posted
function new_window(url) {
link = window.open(url,"Link","to olbar=0,lo cation=0,d irectories =0,status= 0,menubar= 0,scrollba rs=1,resiz able=1,wid th=600,hei ght=500,le ft=40,top= 50");
}
if you want toolbar on your page, set toolbar=1 instead of 0. also you can change height and width etc.
function new_window(url) {
link = window.open(url,"Link","to
}
if you want toolbar on your page, set toolbar=1 instead of 0. also you can change height and width etc.
The minimalist version:
<html>
<head>
<script language='javascript' type='text/javascript'>
<!--
function openWin(url)
{
window.open(url)
}
//-->
</script>
</head>
<body>
<a href="#" onclick="openWin('http://members.aol.com/grassblad')"><img src="http://members.aol.com/grassblad/images/grassAvatar.jpg" alt="GrassBlade Javascript" border="3"></a>
<a href="#" onclick="openWin('http://www.webxpertz.net/forums')"><img src="http://www.webxpertz.net/forums/images/wx/wx_logo.jpg" alt="Webxpertz Forums"></a>
</body>
</html>
Vinny
<html>
<head>
<script language='javascript' type='text/javascript'>
<!--
function openWin(url)
{
window.open(url)
}
//-->
</script>
</head>
<body>
<a href="#" onclick="openWin('http://members.aol.com/grassblad')"><img src="http://members.aol.com/grassblad/images/grassAvatar.jpg" alt="GrassBlade Javascript" border="3"></a>
<a href="#" onclick="openWin('http://www.webxpertz.net/forums')"><img src="http://www.webxpertz.net/forums/images/wx/wx_logo.jpg" alt="Webxpertz Forums"></a>
</body>
</html>
Vinny
ASKER
I put this in Head section:
<script language="JavaScript">
<!--//
function new_window(url) {
link = window.open(url,"Link","to olbar=0,lo cation=0,d irectories =0,status= 0,menubar= 0,scrollba rs=1,resiz able=1,wid th=600,hei ght=500,le ft=40,top= 50");
}
//-->
</script>
I put this in the body:
<a onclick="javascript:new_wi ndow('../h elp/help_r elated_sca cs.htm' )"><img src="../images/SpacersIcon sSquaresGr aphics/squ areoutline 2.gif"></a >
a window the right size opens, but i get a "Cannot find server" "The page cannot be displayed" message.
I tried with an exact path c:/etc.... but that didn't make a difference.
Any help would be appreciated. Thank you.
<script language="JavaScript">
<!--//
function new_window(url) {
link = window.open(url,"Link","to
}
//-->
</script>
I put this in the body:
<a onclick="javascript:new_wi
a window the right size opens, but i get a "Cannot find server" "The page cannot be displayed" message.
I tried with an exact path c:/etc.... but that didn't make a difference.
Any help would be appreciated. Thank you.
since the following works:
<a onclick= "javascript:new_window('http://members.aol.com/grassblad' )">....
i would have to say:
1) there is a typo in path/filename
2) the file and/or folders/directories do not exist
Vinny
<a onclick= "javascript:new_window('http://members.aol.com/grassblad' )">....
i would have to say:
1) there is a typo in path/filename
2) the file and/or folders/directories do not exist
Vinny
ASKER
this page is not at a http: address, which may be the issue...
I can open the page as a regular link, I just can't get it to be a pop up.....
I can open the page as a regular link, I just can't get it to be a pop up.....
ASKER
Does it matter that I am in a frames page?
ASKER
I put everything in one folder, the page I am in, the page I want to open....still can't find it...
you can get it to open as a link? but not a popup? can I see your code?
did you try my version? first as is, then in your page, finally with your data.
Vinny
did you try my version? first as is, then in your page, finally with your data.
Vinny
ASKER
Your code with the http: works fine.
So, I changed the line to:
<a href="#" onclick="openWin('../help/ help_relat ed_scacs.h tm')">
and it can't find the page. The explorer address window shows a path on my computer:
C:\Documents and Settings\XXX\Local Settings\Temporary Internet Files\help\help_related_sc acs.htm
So, as I said in the beginning : how to create a popup window graphic link from my local computer? , the local computer path is an issue with the java script.
Regular links like this one: <a target="main" href="../MaintenancePages/ MaintainTr ailerSCACw Reports.ht m"> work fine.
So, I changed the line to:
<a href="#" onclick="openWin('../help/
and it can't find the page. The explorer address window shows a path on my computer:
C:\Documents and Settings\XXX\Local Settings\Temporary Internet Files\help\help_related_sc
So, as I said in the beginning : how to create a popup window graphic link from my local computer? , the local computer path is an issue with the java script.
Regular links like this one: <a target="main" href="../MaintenancePages/
ASKER
Do I have to have script tags in the body also?
Sorry, I just realized you may not be using IE.
<a href="file:c://Document... ..."
note the two "//"
Vinny
<a href="file:c://Document...
note the two "//"
Vinny
ASKER
This is now working, the only difference was the direction of the slashes. Help/Help_Related_Scacs.ht m'
Head:
<script language="JavaScript">
<!--//
function new_window(url) {
link = window.open(url,"Link","to olbar=0,lo cation=0,d irectories =0,status= 0,menubar= 0,scrollba rs=1,resiz able=1,wid th=600,hei ght=500,le ft=40,top= 50");
}
//-->
</script>
Body
<a onclick="javascript:new_wi ndow('../H elp/Help_R elated_Sca cs.htm')">
<img src="../images/SpacersIcon sSquaresGr aphics/squ areoutline 2.gif" align="right"></a>
Head:
<script language="JavaScript">
<!--//
function new_window(url) {
link = window.open(url,"Link","to
}
//-->
</script>
Body
<a onclick="javascript:new_wi
<img src="../images/SpacersIcon
samplewindow.htm refers to the page that will be opened in the popup
NewButtonWindowName looks like it should be the title for the window, but this doesn't show up on Mozilla Firebird.