Jump to content

If Statement


mcmuney

Recommended Posts

function preg_replace(array_pattern, array_pattern_replace, my_string){
var new_string = String (my_string);
for (i=0; i<array_pattern.length; i++) {
	var reg_exp= RegExp(array_pattern[i], "gi");
	var val_to_replace = array_pattern_replace[i];
	new_string = new_string.replace (reg_exp, val_to_replace);
	return new_string;
}
}
var time = Date(hours+":"+minutes);
var formatedDate = preg_replace('\:\\','',time);

if (current_user_time > time) {
colorA='#000000';
colorB='#00000F';
}
else{
colorA='#00000g';
colorB='#00000w';
}

 

or simplest way

 

var time = Date(hours+""+minutes);
if (current_user_time > time) {
colorA='#000000';
colorB='#00000F';
}
else{
colorA='#00000g';
colorB='#00000w';
}

Link to comment
https://forums.phpfreaks.com/topic/62800-if-statement/#findComment-312637
Share on other sites

the time will be hard coded...

 

<html>
<head>
<script type="text/javascript">
var time = Date(hours+""+minutes);
if (current_user_time == 2100) {
colorA='#000000';
colorB='#00000F';
document.getElementById('body').style.bgcolor=colorA;
}
else{
colorA='#00000g';
colorB='#00000w';
}
</script>
<body id="body">
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/62800-if-statement/#findComment-313718
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.