View Full Version : Button coding?
MrPinkPanther
17-02-2008, 09:49 AM
What code would I give to a button so that when I click it it launches lol.html in a new window at a fixed size of 900x440. A bit like habbo does with their launch the hotel button. +Rep to whoever knows it.
Hayd93
17-02-2008, 09:51 AM
What code would I give to a button so that when I click it it launches lol.html in a new window at a fixed size of 900x440. A bit like habbo does with their launch the hotel button. +Rep to whoever knows it.
I am pretty sure on the lol.html page you would have to enter some code on that so it opens at 900x440.
Decode
17-02-2008, 10:11 AM
http://javascript.internet.com/generators/popup-window.html
MrPinkPanther
20-02-2008, 12:36 PM
http://javascript.internet.com/generators/popup-window.html
Cool site but I want to apply it to a button I have already made not generate another button.
Put this in the head section:
<script language="JavaScript">
function popUpWindow(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=900,height=440');");
}
</script>
and this around the image of your button:
<a href="javascript:popUpWindow('lol.html')"></a>
MrPinkPanther
20-02-2008, 01:34 PM
Put this in the head section:
<script language="JavaScript">
function popUpWindow(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=900,height=440');");
}
</script>
and this around the image of your button:
<a href="javascript:popUpWindow('lol.html')"></a>
Doesnt work, just misaligns all the buttons verticall :( Thanks anyway.
:S Should work :S
I tested it before I posted it, what browser are you using?
DeejayMachoo$
20-02-2008, 02:30 PM
:S Should work :S
I tested it before I posted it, what browser are you using?
No use if it doesnt work in all browsers...
No use if it doesnt work in all browsers...
I'm perfectly aware of that, don't insult my intelligence. I was just asking which browser so I could try it out when I get home.
Obviously it's a very weird thing to happen as a result of the code I gave, so I was going to have a look and see why it did that.
Permission to continue doing so, sir?
Decode
20-02-2008, 04:51 PM
Cool site but I want to apply it to a button I have already made not generate another button.
Just use css to apply the style to the button so it looks like the one you allready made.
MrCraig
20-02-2008, 08:54 PM
use Smifflas method but add an onclick="popUp("lol.htm");" to your button instead of the <a href> bit.
MrPinkPanther
21-02-2008, 10:52 AM
use Smifflas method but add an onclick="popUp("lol.htm");" to your button instead of the <a href> bit.
So what would be the code I would put instead? Im crap at HTML JS etc
Independent
21-02-2008, 12:05 PM
Add onclick="popUp("lol.htm");"
to the end of your button, E.G: <button script="somethingjustusingthistofillspaceetc" onclick="popUp("lol.htm");">
Or use
<a href="lol.html" onclick="popUp('lol.htm') return false;">Button Code</a>
heres an easier way
<a href="#" onClick="chw=window.open('file.html','NewWindow','resizable =no,scrollbars=yes,status=no,width=900,height=440' ); if (chw != null) chw.focus(); return false"> BUTTON </a>
If you dont wish it to scroll just change scrollbars to no :)
Independent
21-02-2008, 05:20 PM
Or use
<a href="lol.html" onclick="popUp('lol.htm') return false;">Button Code</a>
heres an easier way
<a href="#" onClick="chw=window.open('file.html','NewWindow','resizable =no,scrollbars=yes,status=no,width=900,height=440' ); if (chw != null) chw.focus(); return false"> BUTTON </a>
If you dont wish it to scroll just change scrollbars to no :)
I was answering the question to MrCraig's one, but hey.. Fair enough looks a lot better code in an a thing.
MrPinkPanther
21-02-2008, 05:25 PM
Or use
<a href="lol.html" onclick="popUp('lol.htm') return false;">Button Code</a>
What do I put for 'the button code'? As I said I really am a n00b
MrCraig
21-02-2008, 05:25 PM
hm i can never remember window.open javascript parameters tbh
EDIT:
In head:
<script language="JavaScript">
function popUpWindow(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=900,height=440');");
}
</script>
For your button
<input type="button" value="Button Text" onclick="popUp("lol.html");" />
Try that :)
What do I put for 'the button code'? As I said I really am a n00b
<a href="#" onClick="chw=window.open('file.html','NewWindow',' resizable=no,scrollbars=yes,status=no,width=900,he ight=440'); if (chw != null) chw.focus(); return false"> <img src="linktobuttonimage" border="0" /> </a>
Mine or what craig said above do basically the same thing
MrCraig
21-02-2008, 05:31 PM
Yeah, only diff is i use an actual button as opposed to a button image..
could easily do that for the one i posted as well, just thought using an image would be alot easier.
MrCraig
21-02-2008, 05:36 PM
i know you could..
Just you used an anchor as well instead of a straight onclick event.
MrPinkPanther
21-02-2008, 06:23 PM
So whats wrong with this?
<td rowspan="2>
<a href="#" onClick="chw=window.open('file.html','NewWindow',' resizable=no,scrollbars=yes,status=no,width=900,he ight=440'); if (chw != null) chw.focus(); return false"> <img src="images/index_r3_c6.png" border="0" /> </a></a>
</a>
Oh wait it works!!! +rep all
hm i can never remember window.open javascript parameters tbh
EDIT:
In head:
<script language="JavaScript">
function popUpWindow(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=900,height=440');");
}
</script>
For your button
<input type="button" value="Button Text" onclick="popUp("lol.html");" />
Try that :)
When using onclick, you need to use ' instead of " (so onclick="popup('lol.html')") so it doesnt end the tag.
MrCraig
21-02-2008, 08:41 PM
Oh yeah, didnt notice that. Thanks ryan :)
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.