I've been looking and can't find any examples of using spinner buttons on a form with PHP.
Anyone done this? Does it require javascript? Or can it be done in PHP?
Can you make spinner buttons in PHP?
Re: Can you make spinner buttons in PHP?
Ok, I found an example using JS, but I can't get it to work.
Here's the code I'm trying (snipped from a larger part obviously):
It looks fine on screen, but clicking the button does nothing.
Do I need to do something to activate the code somehow? I've never tried putting Javascript inside of form element before so there's probably something I'm missing.
Here's the code I'm trying (snipped from a larger part obviously):
Code: Select all
<td rowspan=2>Strength: <input type="text" name="str" value=20 size=2></td>
<td><input type="button" value="+" onclick="this.form.str.value++;"></td>
<td><input type="button" value="-" onclick="this.form.str.value--;"></td>
Do I need to do something to activate the code somehow? I've never tried putting Javascript inside of form element before so there's probably something I'm missing.
Re: Can you make spinner buttons in PHP?
You can try this:
Give the text field an ID, like this
And to change the value of the box with a button
Use that and you can probably make your own spin box
Give the text field an ID, like this
Code: Select all
<input type="text" value="" id="myBox" />Code: Select all
<input type="button" value="Hello" onClick="javascript: document.getElementById('myBox').value = 'hello world';" />--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
Re: Can you make spinner buttons in PHP?
Code: Select all
<td><input type="text" id="str" value=20 size=2></td>
<td><input type="button" value="+" onclick="javascript: document.getElementById('str').value++;"></td>