SamCorny
Posts : 40 Points : 56 Reputation : 0 Join date : 2017-02-06 Location : NYC
| Subject: Question about custom div Thu Feb 09, 2017 2:03 pm | |
| I know this question is a bit strange but i need to customize a control that is not inside the game. This is the html code: - Code:
-
<!DOCTYPE html> <html lang="en"> <head> <title> MY GAME </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <link rel='stylesheet' type='text/css' href='css/style_interface.css'> </head>
<body> <!-- Interface -->
<!-- SideBar: it contains all tools --> <div class="Interface">
<div class="button" id="newgame"> New game </div>
<div class="button" id="options"> Options </div>
<div class="button" id="quit"> Quit </div>
</div>
<script src="../build/three.js"></script>
.... Now the problem is how can a DIV becomes a button? Thanks guys | |
|
WebForce
Posts : 22 Points : 30 Reputation : 0 Join date : 2017-02-07
| Subject: Re: Question about custom div Thu Feb 09, 2017 3:05 pm | |
| Simply doing this: - Code:
-
<div class="button" onclick='alert("youClickedMe!");'> .... </div>
| |
|
WebForce
Posts : 22 Points : 30 Reputation : 0 Join date : 2017-02-07
| Subject: Re: Question about custom div Thu Feb 09, 2017 3:06 pm | |
| Otherwise if you need to be a clickable div via ID you can do this: - Code:
-
var something = document.getElementById('newgame');
something.style.cursor = 'pointer'; something.onclick = function() { // do something... }; | |
|
SamCorny
Posts : 40 Points : 56 Reputation : 0 Join date : 2017-02-06 Location : NYC
| Subject: Re: Question about custom div Thu Feb 09, 2017 3:37 pm | |
| oh yes the second one!! That's working ... it's what i needed, thanks a lot Webforce!! | |
|
Sponsored content
| Subject: Re: Question about custom div | |
| |
|