02-11-2008, 07:28 PM | #1 |
Charon
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
|
Programming question
Can someone help a brother out?
I have a small "timer" window up that needs to close based on the value of a record in a database. I pull the value from the database and copy it to a hidden form field named "endtime". I have verified that the field contains the proper value. If this value is not empty, then I want the window to close. I am trying to do this via the onload function, but I can't seem to get the code right. I only dabble in Java (most of the script is PHP), so I am a little lost here. This is what I have: <SCRIPT> function init() { //Bring the window to the front if necessary if (document.getElementsByTagName('bringtofront').ite m(0) == "yes") window.focus(); //Close the window if time is up if (document.getElementsByTagName('endtime').item(0) != "") { window.close(); } window.onload = init; </SCRIPT> Any help would be appreciated. Thanks.
__________________
"... the arc of the universe is long but it bends toward justice." Martin Luther King, Jr. |
02-11-2008, 07:30 PM | #2 |
Charon
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
|
Wait a minute. The "TagName" method is wrong. This is a form field, not a tag.
__________________
"... the arc of the universe is long but it bends toward justice." Martin Luther King, Jr. |
02-11-2008, 07:35 PM | #3 |
Charon
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
|
OK, I tried this instead:
<SCRIPT> function init() { //Bring the window to the front if necessary if (document.myform.bringtofront.value == "yes") window.focus(); //Close the window if time is up if (document.myform.endtime.value != "") window.close(); } window.onload = init; </SCRIPT> Still no workey.
__________________
"... the arc of the universe is long but it bends toward justice." Martin Luther King, Jr. Last edited by Jeff Lebowski; 02-11-2008 at 07:40 PM. |
02-11-2008, 07:41 PM | #4 | |
Charon
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
|
Quote:
__________________
"... the arc of the universe is long but it bends toward justice." Martin Luther King, Jr. |
|
02-11-2008, 07:42 PM | #5 |
Senior Member
Join Date: Dec 2006
Posts: 8,596
|
Stop talking to yourself, Leb. Even for a programmer, it's eerie.
__________________
"Have we been commanded not to call a prophet an insular racist? Link?" "And yes, [2010] is a very good year to be a Democrat. Perhaps the best year in decades ..." - Cali Coug "Oh dear, granny, what a long tail our puss has got." - Brigham Young |
02-11-2008, 07:45 PM | #6 |
Charon
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
|
LOL. No kidding.
Hey, nobody was stepping up so I had to answer my own question.
__________________
"... the arc of the universe is long but it bends toward justice." Martin Luther King, Jr. |
Bookmarks |
|
|