What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Quick help with javascript

Quick help with javascript
Author: Message:
Supersonicdarky
Veteran Member
*****

Avatar

Posts: 2317
Reputation: 48
– / – / Flag
Joined: Feb 2005
Status: Away
O.P. Roll Eyes  Quick help with javascript
can someone change this code so instead of it popping up like a popup but have to click something 1st?

code:
<SCRIPT>
function showShoutbox() {
    var x=-30;
    var y=-60;
    if (document.layers) {
        x=x+(window.outerWidth-200)/2;
        y=y+(window.outerHeight-300)/2;
    } else {
        x=x+(screen.Width-200)/2;
        y=y+(screen.Height-300)/2;
    }
    if (x<0) x=0;
    if (y<0) y=0;
    var w=window.open("http://284628.myshoutbox.com/","shoutbox","top="+y+",left="+x+",width=200,height=300,location=0,menubar=0,toolbar=0,status=0,resizable=0,scrollbars=1");
    w.focus();
    return;
}
window.onload=new Function("showShoutbox()");
//-->
</SCRIPT>
04-27-2005 08:21 PM
Profile E-Mail PM Find Quote Report
user27089
Disabled Account


Posts: 6321
Joined: Nov 2003
Status: Away
RE: Quick help with javascript
in the <head> </head> area put this:

code:
<script language="javascript">

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

</script>

then to make the link it would be:

code:
<a href="url" onclick="NewWindow(this.href,'name','400','400','yes');return false">Name of Url</a>


This post was edited on 04-27-2005 at 08:30 PM by user27089.
04-27-2005 08:30 PM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Quick help with javascript
Or, just remove the window.onLoad() function, and add the following to a link:
code:
onClick="showShoutbox()"
Or:
code:
href="javascript:showShoutbox()"
Edit: [code] should also enable [noparse]

This post was edited on 04-27-2005 at 09:52 PM by RaceProUK.
[Image: spartaafk.png]
04-27-2005 09:52 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On