Reply
change to number?
Old 06-19-2005, 11:07 PM change to number?
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
I have a form named "addappt".
I have two field that is "begintime" and "endtime".
Both are dropdown list. Thier value
format is "00:00". A time format.
My problem is, when i compare them,
there were no value.As you can see in line
number 7 below. Even when I display
them (begintime or endtime) using
document.write(begintime), it will display nothing.

How can i make this happen. Can anyone please
show me how to convert "begintime" and "endtime"
to numbers, or at least strip down
the ":" thing which is between them "00:00"
here. Or, how can i pass the value from the form which is already converted into number.

PHP Code:
<script type="text/javascript">
function validate()
{
4 x=document.addappt
5 begintime
=x.begintime.value
6 endtime
=x.endtime.value
if (endtime begintime)
{
9 alert("Invalid timeframe.")
10 return false
11 
}
12 else
13 {
14 return true
15 
}
16 }
17 </script> 
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-19-2005, 11:59 PM
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
I make it simpler. In javascript...how to convert from
"10:00" to "1000" where 1000 is an interger or number value?
"10:00" comes from a dropdown box in a form (doesn't matter anyway).
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
Old 06-20-2005, 04:03 AM answer
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
I finally got the answer....just wanna let yall know.

PHP Code:
<script type="text/javascript">
function validate()
{
4 x=document.addappt
5 begintime
=x.begintime.value.replace(":","")
6 endtime=x.endtime.value.replace(":","")
if (endtime begintime)
{
9 alert("Invalid timeframe.")
10 return false
11 
}
12 else
13 {
14 return true
15 
}
16 }
17 </script> 
Lets learn together....thanks.
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to change to number?
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11993 seconds with 12 queries