cougarguard.com — unofficial BYU Cougars / LDS sports, football, basketball forum and message board  

Go Back   cougarguard.com — unofficial BYU Cougars / LDS sports, football, basketball forum and message board > non-Sports > Chit Chat
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 02-11-2008, 07:28 PM   #1
Jeff Lebowski
Charon
 
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
Jeff Lebowski is on a distinguished road
Default 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.
Jeff Lebowski is offline   Reply With Quote
Old 02-11-2008, 07:30 PM   #2
Jeff Lebowski
Charon
 
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
Jeff Lebowski is on a distinguished road
Default

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.
Jeff Lebowski is offline   Reply With Quote
Old 02-11-2008, 07:35 PM   #3
Jeff Lebowski
Charon
 
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
Jeff Lebowski is on a distinguished road
Default

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.
Jeff Lebowski is offline   Reply With Quote
Old 02-11-2008, 07:41 PM   #4
Jeff Lebowski
Charon
 
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
Jeff Lebowski is on a distinguished road
Default

Quote:
Originally Posted by Jeff Lebowski View Post
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.
Never mind. This code worked after all. Just had a couple of minor syntax issues (extra paren or two).
__________________
"... the arc of the universe is long but it bends toward justice." Martin Luther King, Jr.
Jeff Lebowski is offline   Reply With Quote
Old 02-11-2008, 07:42 PM   #5
Tex
Senior Member
 
Tex's Avatar
 
Join Date: Dec 2006
Posts: 8,596
Tex is on a distinguished road
Default

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
Tex is offline   Reply With Quote
Old 02-11-2008, 07:45 PM   #6
Jeff Lebowski
Charon
 
Join Date: Jan 2006
Location: In the heart of darkness (Provo)
Posts: 9,564
Jeff Lebowski is on a distinguished road
Default

Quote:
Originally Posted by Tex View Post
Stop talking to yourself, Leb. Even for a programmer, it's eerie.
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.
Jeff Lebowski is offline   Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:16 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.