View Full Version : target="wmc"
epyon
03-06-2006, 09:22 PM
I've been trying to figure out how to open a new page by clicking on a url, and i know u can have it as target="_blank" but i want the new window to open in a specifice size. (an example is that the new window opens, being 100x200px)
I looked at the script for a site i saw this on and they had target="wmc" and so i tried it and the new window pops up but i cant figure out how to make the window a custom size, so thats what i need help with please :D
GuitarHero
03-06-2006, 09:49 PM
I think you new javascript to do that, not sure if its the only way but i know you can do it with js. I dont recall the script because its not one ive used before but the javascript forum may help.
erisco
03-06-2006, 10:15 PM
epyon, this is done with JavaScript as GuitarHero mentioned. This page may interest you...
http://www.pageresource.com/jscript/jwinopen.htm
Kravvitz
03-06-2006, 10:24 PM
http://www.alistapart.com/articles/popuplinks/
epyon
03-07-2006, 09:44 PM
Thank you very much, (i didnt find the first link to be what i needed but the second link is what i think im looking for) any ways i have a problem
i have very little java script knowledge and so i made this code and a few others but i couldnt seem to get anything to work other then a new window poping up, i figured its pointless for me to keep trying different things so if its not to much could some one help me out with the code...
<script language="JavaScript">
function event_popup(e) {
link_popup(e.currentTarget);
e.preventDefault();
}
listen('load', window, function() {
listen('click', 'my-popup-link', event_popup);
// ... other onload statements
}
);
mlisten(
'click',
document.getElementById('my-popup-link').»
getElementsByTagName('a'),
event_popup
);
function event_popup_features(features) {
return function(e) {
link_popup(e.currentTarget, features);
e.preventDefault();
}
}
// onload...
listen(
'click',
'my-popup-link',
event_popup_features('width=300,height=800')
);
</script>
<a id="my-popup-link"
href="http://examplpe.com"
target="_blank">pop me up</a>
Kravvitz
03-07-2006, 11:12 PM
Where's the code for the listen function?
The "»" means that line is wrapped to the next line, so change
document.getElementById('my-popup-link').»
getElementsByTagName('a'),
to
document.getElementById('my-popup-link').getElementsByTagName('a'),
Change
language="JavaScript"
to
type="text/javascript"
epyon
03-07-2006, 11:30 PM
so then it should look like this right...
<script type="text/javascript">
function event_popup(e) {
link_popup(e.currentTarget);
e.preventDefault();
}
listen('load', window, function() {
listen('click', 'my-popup-link', event_popup);
// ... other onload statements
}
);
mlisten(
'click',
document.getElementById('my-popup-link').getElementsByTagName('a'),
event_popup
);
function event_popup_features(features) {
return function(e) {
link_popup(e.currentTarget, features);
e.preventDefault();
}
}
// onload...
listen(
'click',
'my-popup-link',
event_popup_features('width=300,height=800')
);
</script>
<a id="my-popup-link"
href="http://examplpe.com"
target="_blank">pop me up</a>
but for some reason it just still dosnt work. (this is a script compatible with Firefox right?)
Kravvitz
03-07-2006, 11:42 PM
The code for the listen function is still missing. Yes, it's compatible with Firefox.
Under "The source" you need the code from the two .js files there.
Take a look at the code in the examples page (http://www.alistapart.com/d/popuplinks/examples.html) to see how to use it.
epyon
03-07-2006, 11:54 PM
Ahh! awsome i got it, ^_^ thanx!!
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.