oh wise ones… your guidance is desperately needed!
any thoughts at all PLEASE would be greatly appreciated!! even insults are welcome!! this should be easy as pie, but I’ve been banging my head on the wall and going around in circles all morning! spent a long time on “the Google” looking for my problem. all I found was maybe I shouldn’t be using document.write, but found no alternative. plus it works (the first time through anyways).
I have a pop up window where users schedule an event to post on a calendar. events occur once, or repeat (say weekly, for example).
here is what I need the script to do:
check a drop down form to see if user wants event to repeat or not. default is not. this part is working fine.
if event repeats we HIDE a time input form. this part is working fine.
if event does NOT repeat we SHOW the time input form. this part working fine.
but what I thought would be the simplest part is not working. my_var is just a lousy string that I want to write. it should show “End Date” if event does not repeat, or “Repeat Until” if event does repeat. but I can’t get the damn thing to work. I know just about zero javascript. I understand it is browser side, not server side and that’s about it.
sorry about no link for you guys to try the script yourselves. this thing is running on my localhost. not ready for prime-time
THANK YOU for your valuable time. here is the offending code:
<head>
<script type=“text/javascript”>
<!–
repeat_var=“End Date:”;
function writebox(form) {
if (form.repeat.value==‘0’) {
repeat_var=“End Date:”;
document.getElementById(“dTimeE”).style.visibility = “visible”;
} else {
repeat_var=“Repeat Until:”;
document.getElementById(“dTimeE”).style.visibility = “hidden”;
}
}
//–>
</script>
</head>
<body>
<td>
<select name=“repeat” title=“Select how often” id=“repeat” onchange=“writebox(this.form)”>
<option value=“0”<?php echo (!$_POST[“repeat”]) ? ’ selected=“selected”>’ : “>”; echo $xx[“evt_none”]; ?></option>
<option value=“1”<?php echo ($_POST[“repeat”] == “1”) ? ’ selected=“selected”>’ : “>”; echo $xx[“evt_daily”]; ?></option>
<option value=“2”<?php echo ($_POST[“repeat”] == “2”) ? ’ selected=“selected”>’ : “>”; echo $xx[“evt_weekly”]; ?></option>
<option value=“3”<?php echo ($_POST[“repeat”] == “3”) ? ’ selected=“selected”>’ : “>”; echo $xx[“evt_monthly”]; ?></option>
<option value=“4”<?php echo ($_POST[“repeat”] == “4”) ? ’ selected=“selected”>’ : “>”; echo $xx[“evt_yearly”]; ?></option>
</select>
</td>
<td><script type=“text/javascript”>document.write(repeat_var);</script></td>
<td id=“dTimeE”<?php echo $hidden; ?>><input type=“text” title=“click clock icon or enter HH:MM XM” name=“end_time” id=“end_time” value=“<?php echo $_POST[“end_time”]; ?>” size=“6” /><a href=“#” onclick=“tPicker(‘end_time’)”><img src=“images/flipped_clock.png” alt=“End Time” /></a>
</body>