View Full Version : Javascript: Returning to top
jlp09550
09-26-2007, 07:34 PM
No, this isn't asking how to push the page to the top, but to solve a "top redirecting" issue with my Javascripts.
Okay, say I have a window.open. When I click the link, it pushes the page to the very top.
Here's an example:
<a href='#' onClick='window.open("bbcode.php", "bbcodes", "resize=0, toolbar=0, menubar=0, resizeable=0, width=250, height=500");'>BBCode</a>
This code will push the page to the top, no matter what.
<a href='javascript:window.open("bbcode.php", "bbcodes", "resize=0, toolbar=0, menubar=0, resizeable=0, width=250, height=500");'>BBCode</a>
.. just outputs [object] ..
Help?
When you say very top, do you mean like top of the monitor or top of the browser window?
jlp09550
09-26-2007, 07:50 PM
When you say very top, do you mean like top of the monitor or top of the browser window?
Top of the browser window, like where the headers on the page are.
Sorta like how we have it here?
jlp09550
09-27-2007, 09:47 PM
Sorta like how we have it here?
Yeah.. duno why it does it only on my site.
Probably just a tiny typo in there somewhere. -shrug-
Yeah.. duno why it does it only on my site.Did you try to copy the code?
jlp09550
09-27-2007, 09:50 PM
Did you try to copy the code?
Yup, sure did.
That didn't work either mate?
jlp09550
09-27-2007, 09:53 PM
That didn't work either mate?
Nope.. :/
What's the latest code you're working with?
FuRom
09-27-2007, 10:09 PM
<script language="JavaScript1.2" type="text/javascript">
function popper(var1, var2, var3, var4){
eval(var1 + ' = window.open(var2, var3, var4);');
}
</script>
<a href="javascript:popper('winix', 'win2.html', 'Window2', 'width=310,height=600,scrollbars=yes');">BBCode</a>
Try playing around with that. I don't get why your code wasn't working. It truly baffles me, it looks no different than what I would normally use myself, but whatever, I gave in and just done this. I hate defining a function just for a popup, but I did it in this case. I hope this helps. Sorry I couldn't just fix what your code.
jlp09550
09-27-2007, 10:20 PM
<script language="JavaScript1.2" type="text/javascript">
function popper(var1, var2, var3, var4){
eval(var1 + ' = window.open(var2, var3, var4);');
}
</script>
<a href="javascript:popper('winix', 'win2.html', 'Window2', 'width=310,height=600,scrollbars=yes');">BBCode</a>
Try playing around with that. I don't get why your code wasn't working. It truly baffles me, it looks no different than what I would normally use myself, but whatever, I gave in and just done this. I hate defining a function just for a popup, but I did it in this case. I hope this helps. Sorry I couldn't just fix what your code.
Thanks! That solved the issue.
Can be closed now.
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.