Author |
Message |
Puckdropper
Site Admin
Joined: 02 Oct 2004
Posts: 767
Location: Not in Chicago
|
Posted:
Fri Jun 24, 2005 10:06 am |
|
I'm using PHP and some HTML (I know, "Beta", I know.) to create forms for a personal project. What I want (or at least think I want (-;) to do is have a check box marked "New" and have a text input box that is enabled then.
How can I do this? I don't want to reload the page or switch to something else. |
|
|
|
|
mf_2
Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany
|
Posted:
Fri Jun 24, 2005 7:04 pm |
|
I think you *have* to use javascript for that. I had the same problem a while back. I 'solved' it by simply ignoring the input in the text field if 'new' wasn'rt checked, I could do that with php and I didn';t want to use anything client-specific such as javascript. |
|
|
|
|
ß
Joined: 04 Oct 2004
Posts: 114
Location: ~/
|
Posted:
Fri Jun 24, 2005 7:31 pm |
|
I'm an Eszett, not a Beta!
Anyway, to answer your question: Use the Document Object Model + some JavaScript:
Code: |
<script type="text/javascript">
function foo_toggle()
{
foo_form = document.getElementById("fooForm");
foo_form_hidden = foo_form.getAttribute("type");
foo_form.setAttribute("type", foo_form_hidden == "hidden" ? "" : "hidden");
}
</script>
<input type="checkbox" name="foo" onclick="foo_toggle();">check me!<br />
<input name="fooForm" id="fooForm">
|
Works in Firefox, but not IE. IE states that "The command is not supported" for the line with the call to setAttribute.
edit: You can do it with CSS too, but again it does not work in IE.
Code: |
<style type="text/css">
.hidden {
display: none;
}
</style>
<script type="text/javascript">
function foo_toggle()
{
foo_form = document.getElementById("fooForm");
foo_form_hidden = foo_form.getAttribute("type");
foo_form.setAttribute("type", foo_form_hidden == "hidden" ? "" : "hidden");
}
function foo_toggle_css()
{
foo_form = document.getElementById("fooForm");
foo_form_hidden = foo_form.getAttribute("class");
foo_form.setAttribute("class", foo_form_hidden == "hidden" ? "" : "hidden");
}
</script>
<input type="checkbox" name="foo" onclick="foo_toggle_css();">check me!<br />
<input class="" name="fooForm" id="fooForm">
|
edit #2:
I found a method that works in both IE and Firefox!
Code: |
<script type="text/javascript">
function foo_toggle_css2()
{
foo_form = document.getElementById("fooForm");
if (foo_form.style.display == "inline")
{
foo_form.style.display = "none";
}
else
{
foo_form.style.display = "inline";
}
}
</script>
<input type="checkbox" name="foo" onclick="foo_toggle_css2();">check me!<br />
<input name="fooForm" id="fooForm">
|
|
|
|
|
|
Puckdropper
Site Admin
Joined: 02 Oct 2004
Posts: 767
Location: Not in Chicago
|
Posted:
Sat Jun 25, 2005 4:26 am |
|
Thanks to both F7, Eszett, faux-beta and mf_2. I used mf_2's suggestion, as it was easiest to do. I've got about 20 hours more work in what I'm working on before it can become public!
(For the curious, it's my own version of a web-log system... Written completely from scratch.) |
_________________ >say "Hello sailor"
Nothing happens here.
>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer. |
|
|
|
ß
Joined: 04 Oct 2004
Posts: 114
Location: ~/
|
Posted:
Sat Jun 25, 2005 5:35 pm |
|
( (F7 == ß) && (ß == F7) ) |
|
|
|
|
mf_2
Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany
|
Posted:
Sat Jun 25, 2005 7:42 pm |
|
I used to work on a weblog system a while back, I abandoned the project though when I discovered the excellent access.log logfile of the apache2. it tells you everything you possibly want to know and wioth a nice program such as 1-2-3 analyzer it will also give you the output in fancy diagrams and tables. |
|
|
|
|
Puckdropper
Site Admin
Joined: 02 Oct 2004
Posts: 767
Location: Not in Chicago
|
Posted:
Mon Jul 04, 2005 9:22 am |
|
Well, I'm done. You can't see the page in question unless you log in with my account, and I'm not going to let anyone do that. Security starts with me
http://www.puckdroppersplace.us/blog/ |
_________________ >say "Hello sailor"
Nothing happens here.
>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer.
Last edited by Puckdropper on Tue Jun 19, 2007 10:57 am; edited 1 time in total |
|
|
|
mf_2
Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany
|
Posted:
Mon Jul 04, 2005 9:31 pm |
|
interesting site, though the readability is not incredible. |
|
|
|
|
Puckdropper
Site Admin
Joined: 02 Oct 2004
Posts: 767
Location: Not in Chicago
|
Posted:
Tue Jul 05, 2005 12:09 am |
|
I noticed that. I'm going to have to work on it. Perhaps use a different PC board for the background. The PC-100 RAM I have looks rather monotonatic... Hm...
I'm already thinking about version 0.3, which will undoubtably address a few issues. |
_________________ >say "Hello sailor"
Nothing happens here.
>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer. |
|
|
|
mf_2
Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany
|
Posted:
Tue Jul 05, 2005 3:54 am |
|
well, why use an image as a background at all? just use a color as bg |
|
|
|
|
Puckdropper
Site Admin
Joined: 02 Oct 2004
Posts: 767
Location: Not in Chicago
|
Posted:
Tue Jul 05, 2005 10:05 am |
|
I want to try a few things for backgrounds first... Thankfully background changes are easy due to includes and requires. (PHP's best feature for web page presentation!)
There's a solid color behind the background, but it doesn't look all that great.
I'm going to have to change the light-blue background in the message bodies to something easier to read the white text on.
Edit:
I tried using a piece of PC-100 RAM for a background, but the solder traces created light areas against the dark areas. Not a good thing. I do have a new color scheme, it'll hopefully be better, but I'm not sure I like it much. |
|
|
|
|
mf_2
Joined: 02 Oct 2004
Posts: 377
Location: Stuttgart, Germany
|
Posted:
Tue Jul 05, 2005 10:49 pm |
|
it looks like you removed the background. it looks better now. |
|
|
|
|
Puckdropper
Site Admin
Joined: 02 Oct 2004
Posts: 767
Location: Not in Chicago
|
Posted:
Sun Jul 10, 2005 11:41 pm |
|
I did. I'm trying to think of a new color scheme... Remember Grimalkin? He had an amber on black scheme when he had his site up. I'm thinking of going to that, but I'm not commiting to anything except using PHP's global function. (I have all my colors set in one file and then the other files use those colors but since PHP doesn't do variable scoping like the other long-established languages I have to use the global function (statement | command). |
_________________ >say "Hello sailor"
Nothing happens here.
>score
Your score is 202 (total of 350 points), in 866 moves.
This gives you the rank of Adventurer. |
|
|
|
|