473,608 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening link in a new template/aready defined/ window

I am trying to open a link in a new template window :
<a onclick="window open('example.h tml','example') ;return false;"
href="http://www.example.com " target="_blank" example link</a>

such that clicking on the example link will open it in a new window in an
already saved template/site/ called example.html

Jan 15 '07 #1
26 2973
ASM
Nospam a écrit :
I am trying to open a link in a new template window :
<a onclick="window open('example.h tml','example') ;return false;"
href="http://www.example.com " target="_blank" example link</a>

such that clicking on the example link will open it in a new window in an
already saved template/site/ called example.html
soluce 1 :

<a href="http://www.example.com " target="example "example link</a>
soluce 2 :

<a onclick="window .open('','examp le');"
href="http://www.example.com " target="example "example link</a>

soluce 3 :

<a onclick="window .open(this.href );return false;"
href="http://www.example.com "example link</a>
I do not understand : open a html file in a template.

Some softs can help to create a new html file with a template.
Idea in php :
http://dosimple.ch/articles/Template...ate.class.phps

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 15 '07 #2
I do not understand : open a html file in a template.
I mean lets say I have an animation
animation.swf

and I want to open it in a new window, but not a _blank window, a window
that I have already made that has my logo and text and in the middle I want
the animation to show, I understand I can just create a webpage call it
template.html and have some text title e.t.c but I am confused how I show
the animation in this page as a popup
Jan 15 '07 #3
ASM
Nospam a écrit :
>I do not understand : open a html file in a template.

I mean lets say I have an animation
animation.swf

and I want to open it in a new window, but not a _blank window, a window
that I have already made that has my logo and text and in the middle I want
the animation to show, I understand I can just create a webpage call it
template.html and have some text title e.t.c but I am confused how I show
the animation in this page as a popup
Let's suppose in your 'template.html' you have a div 'content' :

Code in your mother page :

<script type="text/javascript">
var truc = false;
function loadFlash(myFla sh) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('te mplate.htm');
truc.onload = function() {
var cible = truc.document.g etElementById(' content');
var flash = document.create Element('OBJECT ');
flash.type = "applicatio n/x-shockwave-flash";
flash.data = myFlash;
flash.width = '128'; // here put correct
flash.height = '128'; // width and height
// params of your swf :
flash.innerHTML = '<param name=movie value="'+myFlas h+'">';
// empty the div 'content' of popup
while(cible.fir stChild) {cible.removeCh ild(cible.first Child);};
// display the flash animation
cible.appendChi ld(flash);
truc.focus();
}
return false;
}
</script>

<a href="bidule.sw f" onclick="loadFl ash(this);">bid ule</a>
<a href="foo.swf" onclick="loadFl ash(this);">foo </a>

The popup has not to be closed before to open a new swf in it
(Here sizes of these swf are same)
Variante with sizing :

<script type="text/javascript">
var truc = false;
function loadFlash(myFla sh, w, h) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('te mplate.htm','', 'width=600,heig ht=550,'+
'resizing=1,scr ollbars=1');
truc.onload = function(){open er.flashy(myFla sh,w,h);};
truc.focus();
return false;
}
function flashy(myFlash, w,h) {
var cible = truc.document.g etElementById(' content');
var flash = document.create Element('OBJECT ');
flash.type = "applicatio n/x-shockwave-flash";
flash.data = myFlash;
flash.width = w; // here put correct
flash.height = h; // width and height
// params of your swf :
flash.innerHTML = '<param name=movie value="'+myFlas h+'">';
// empty the div 'content' of popup
while(cible.fir stChild) cible.removeChi ld(cible.firstC hild);
// display the flash animation
cible.appendChi ld(flash);
}
</script>

<a href="bidule.sw f" onclick="loadFl ash(this,128,12 8);">bidule</a>
<a href="foo.swf" onclick="loadFl ash(this,360,24 0);">foo</a>

Not tested ...

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 15 '07 #4
I am wondering how it could be done with more than one animation
link:

:
<a onclick="window open('','exampl e');return false;"
href=http://www.example.com/animation.swf target="example "example link
1</a>
<a onclick="window open('','exampl e');return false;"
href=http://www.example.com/animation2.swf target="_blank" example link
2</a>

such that clicking on the example link 1 or link 2 will open it in a
new window in an already saved template/site/ called example.html, how
could I amend your code so that
<a href="bidule.sw f" onclick="loadFl ash(this);">bid ule</a>
<a href="foo.swf" onclick="loadFl ash(this);">foo </a>

bidule.swf and foo.swf are not the only ones to show in a new
template (any link with animation in the url)

thanks
Jan 15 '07 #5
ASM
Nospam a écrit :
I am wondering how it could be done with more than one animation
link:

:
<a onclick="window open('','exampl e');return false;"
href=http://www.example.com/animation.swf target="example "example link
1</a>
<a onclick="window open('','exampl e');return false;"
href=http://www.example.com/animation2.swf target="_blank" example link
2</a>

such that clicking on the example link 1 or link 2 will open it in a
new window in an already saved template/site/ called example.html,
With what you give up there :
1) will open 'animation.swf' in :
- if JS a new normal window containing html target 'example'
- if no JS in a new normal window
using same window for each call targeted 'example'
witch is html name of new/old window
2) will open 'animation2.swf '
same as above (1)
but, in html without JS, each call will fire in a new blank window
how could I amend your code so that
<a onclick="loadFl ash(this);" target="example "
href=http://www.example.com/animation.swfex ample link 1</a>
<a onclick="loadFl ash(this);" target="example "
href=http://www.example.com/animation3.swfe xample link 3</a>
<a onclick="loadFl ash(this);" target="example "
href=http://www.example.com/animation4.swfe xample link 4</a>
<a onclick="loadFl ash(this);" target="_blank"
href=http://www.example.com/animation2.swfe xample link 2</a>
<a onclick="loadFl ash(this);" target="_blank"
href=http://www.example.com/animation5.swfe xample link 5</a>

Or use the variant witch specify width and height of flash
<a onclick="loadFl ash(this,360,24 0);" target="example "
href=http://www.example.com/animation.swfex ample link 1</a>

How it is supposed to work (remember: not tested) :

On calling loadFlash() :
- if popup already open :
- close popup
- if no popup (or closed popup)
- open new popup with file 'template.html'
- when file 'template.html' is loaded
-insert in div 'content' of this file
your flash called in href of the link
- put popup in front
- abort html call

Example for canvas file 'template.html'

<html>
<head>
<title>My beautiful flash</title>
<link href="styles.cs s" type="text/css">
</head>
<body>
<h1 id="header">wel come</h1>
<div id="content">
<p>Place for swf file</p>
</div>
<p id="footer">bye </p>
</body>
</html>
You can also open an empty popup
then fill it with html code :

function loadFlash(myFla sh, w, h) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('', '','width=600,h eight=550,'+
'resizing=1,scr ollbars=1');
var htm = '<html><link href="styles.cs s" type="text/css">';
htm += '<h1 id="header"><im g src="logo.jpg"h ello<\/h1>';
htm += '<object "applicatio n/x-shockwave-flash" data="'+myFlash +'" ';
htm += 'width='+w+' height='+h+'><p aram name=movie ';
htm += 'value="'+myFla sh+'"><\/object>';
htm += '<p id="footer">bi e bie<\/p><\/html>';
truc.document.o pen();
truc.document.w rite(htm);
truc.document.c lose();
return false;
}

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 15 '07 #6
I have in the main page:
<html>
<body>
<script type="text/javascript">
function loadFlash(myFla sh, w, h) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('', '','width=600,h eight=550,'+

'toolbar=no,sta tus=no,menubar= no,scrollbars=n o,resizable=no, directories=no, l
ocation=no');
var htm = '<html><link href="styles.cs s" type="text/css">';
htm += '<h1 id="header"><He llo<\/h1>';
htm += '<object "applicatio n/x-shockwave-flash" data="'+myFlash +'" ';
htm += 'width='+w+' height='+h+'><p aram name=movie ';
htm += 'value="'+myFla sh+'"><\/object>';
htm += '<p id="footer">bi e bie<\/p><\/html>';
truc.document.o pen();
truc.document.w rite(htm);
truc.document.c lose();
return false;
}
</script>

<li>
<a onclick="loadFl ash(this);" href="http://www.example.com/animation1.swf"
target="one">
First animation</a</li>
<li>
<a onclick="loadFl ash(this);" href="http://www.example.com/animation2.swf"
target="one">
second animation</a</li>
<li>
<a onclick="loadFl ash(this);" href="http://www.example.com/animation3.swf"
target="one">
Third animation</a</li>

</body>
</html>

...

But each time I click on any of the links it opens it in a new window and
not in the new popup.
Jan 15 '07 #7
so far I have amended the code, but it only shows the popup on the first
click (without the animation, just an empty popup), every other click shows
the animation in a new window
<html>
<body>
<script type="text/javascript">
var truc = false;
function loadFlash(myFla sh, w, h) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('', '','width=600,h eight=550,'+

'toolbar=no,sta tus=no,menubar= no,scrollbars=n o,resizable=no, directories=no, l
ocation=no');
var htm = '<html><link href="styles.cs s" type="text/css">';
htm += '<h1 id="header"><He llo<\/h1>';
htm += '<object "applicatio n/x-shockwave-flash" data="'+myFlash +'" ';
htm += 'width='+w+' height='+h+'><p aram name=movie ';
htm += 'value="'+myFla sh+'"><\/object>';
htm += '<p id="footer">bi e bie<\/p><\/html>';
truc.document.o pen();
truc.document.w rite(htm);
truc.document.c lose();
}
</script>

<li>
<a onclick="loadFl ash(this); return false"
href="http://www.example.com/animation1.swf"
target="one">
First animation</a</li>
<li>
<a onclick="loadFl ash(this); return false"
href="http://www.example.com/animation2.swf"
target="one">
second animation</a</li>
<li>
<a onclick="loadFl ash(this); return=false"
href="http://www.example.com/animation3.swf"
target="one">
Third animation</a</li>

Jan 16 '07 #8
ASM
Nospam a écrit :
so far I have amended the code, but it only shows the popup on the first
click (without the animation, just an empty popup),
Of course you did have forgotten sizes of swg
every other click shows
then JS is broken
the animation in a new window
and only html is still working
function loadFlash(myFla sh, w, h) {
(snip)
htm += '<h1 id="header"><He llo<\/h1>';
htm += '<h1 id="header"Hell o <\/h1>';

(snip)
<a onclick="loadFl ash(this); return false"
<a onclick="loadFl ash(this,255,17 4); return false"
that bellow would have to work :

<html>
<script type="text/javascript">
var truc = false;
function loadFlash(myFla sh, w, h) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('', '','width=600,h eight=550,'+
'toolbar=no,sta tus=no,menubar= no,scrollbars=n o,'+
'resizable=no,d irectories=no,l ocation=no');
var htm = '<html><link href="styles.cs s" type="text/css">';
htm += '<h1 id="header">Hel lo<\/h1>';
htm += '<object "applicatio n/x-shockwave-flash" data="'+myFlash +'" ';
htm += 'width='+w+' height='+h+'><p aram name=movie ';
htm += 'value="'+myFla sh+'"><\/object>';
htm += '<p id="footer">bi e bie<\/p><\/html>';
truc.document.o pen();
truc.document.w rite(htm);
truc.document.c lose();
}
</script>
<ul>
<li>
<a onclick="loadFl ash(this,128,12 8); return false"
href="http://www.example.com/animation1.swf"
target="one">
First animation</a</li>
<li>
<a onclick="loadFl ash(this,320,24 0); return false"
href="http://www.example.com/animation2.swf"
target="one">
second animation</a</li>
<li>
<a onclick="loadFl ash(this,160,90 ); return false"
href="http://www.example.com/animation3.swf"
target="one">
Third animation</a</li>
</ul>
</html>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 17 '07 #9
I am unable to see the animation just a big X that means a broken link, this
is what the code looks like:

<html>
<script type="text/javascript">
var truc = false;
function loadFlash(myFla sh, w, h) {
myFlash = myFlash.href;
if(truc && !truc.closed) truc.close();
truc = window.open('', '','width=600,h eight=550,'+
'toolbar=no,sta tus=no,menubar= no,scrollbars=n o,'+
'resizable=no,d irectories=no,l ocation=no');
var htm = '<html><link href="styles.cs s" type="text/css">';
htm += '<h1 id="header">Hel lo<\/h1>';
htm += '<object "applicatio n/x-shockwave-flash" data="'+myFlash +'" ';
htm += 'width='+w+' height='+h+'><p aram name=movie ';
htm += 'value="'+myFla sh+'"><\/object>';
htm += '<p align=right<scr ipt type="text/javascript"><!--';
htm += 'google_ad_clie nt = "pub-45886979038586" ';
htm += 'google_ad_widt h = 120';
htm += 'google_ad_heig ht = 600';
htm += 'google_ad_form at = "120x600_as "';
htm += 'google_ad_type = "image"';
htm += '//2007-01-14: creen';
htm += 'google_ad_chan nel = "6541907411 "';
htm += '//--><\/script>';
htm += '<script type="text/javascript"';
htm += ' src="http://pagead2.googles yndication.com/pagead/show_ads.js">';
htm += '<\/script><\/p>';
htm += '<p id="footer">bi e bie<\/p><\/html>';
truc.document.o pen();
truc.document.w rite(htm);
truc.document.c lose();
}
</script>
<ul>
<li>
<a onclick="loadFl ash(this,128,12 8); return false"
href="http://www.example.com/animation1.swf"
target="one">
First animation</a</li>
<li>
<a onclick="loadFl ash(this,320,24 0); return false"
href="http://www.example.com/animation2.swf"
target="one">
second animation</a</li>
<li>
<a onclick="loadFl ash(this,160,90 ); return false"
href="http://www.example.com/animation3.swf"
target="one">
Third animation</a</li>
</ul>
</html>
Jan 17 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
11527
by: Suzanne | last post by:
Hi++, I get a link error when I try to call a template function that is declared in a header file and defined in a non-header file. I do *not* get this link error if I define the template function directly in the header file, or if the change the function to non-template. For example... *** Why am I getting a link error for template function f() in the code below?
4
11143
by: Ciar?n | last post by:
Hi all, I've go a little mailto: link on a page that when clicked opens an email form with the email address in the To field - all very simple. Problem is that in Netscape, a new blank window is opened up as well, along with the email form. Is there a way to stop this blank window from opening? Below is the relevant code. My test browsers are IE 6 and NS 7. function openwindow(location,width,height,name){
44
4694
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the body of the page I put the next code: <BODY onkeydown='notOpenNewWindow();'>
14
11064
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
2
1783
by: Keshav Gadia | last post by:
Hi, I am an ASP.net newbie. I am writing a user control that is made up of datagrid with one of the columns opening a new window to display some details on click of the set image. I have basically used ImageButton server control. The problem is because I have used a server control with runat="server",the parent page is posted back and even though the window opens up,the focus gets set to the parent window. What I want is,the new window...
1
1533
by: Sushil Prasad | last post by:
hi, I have a web application with a help link. On the click of the help link user see a html page. I do response.redirect to url in my code. The vb.net application that user was using gets overloaded with html page. Is there a way to display this html in a new web page so that user can see both the web application and this html page.
3
2131
by: Larry Bud | last post by:
Wanting to use a technology I saw for one of our apps. We have several apps that a user logs in at on the same page. The app is determined by a drop down. User credentials are checked, response.redirect to the application. The user ID is stored in a session variable which determines if the user is logged in. When the session var goes blank, the user is redirected to the login page. A header on each page checks this. Now, some...
5
2558
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it without any problem when the client use Word XP & 2003 but no result with Word 2000. Any suggestions are welcomed,
15
2860
by: anon | last post by:
I have a page where the ASP script create a table of links i.e. 1 = NextPage.asp?Item=1 2 = NextPage.asp?Item=2 etc What I would like to do is open an new window with this link without any toolbars, addressbars, scrollbars and tabs. I would be happy even if the
0
8059
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8000
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.