Shoutbox

Quick help with javascript - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Quick help with javascript (/showthread.php?tid=43753)

Quick help with javascript by Supersonicdarky on 04-27-2005 at 08:21 PM

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>

RE: Quick help with javascript by user27089 on 04-27-2005 at 08:30 PM

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>


RE: Quick help with javascript by RaceProUK on 04-27-2005 at 09:52 PM

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][/code]