хочу вставить ява скрипт на страницу. Скрипт делается при загрузке страницы.
<script type='text/javascript'>
/* <![CDATA[ */
window.onload = function() {
<?php $aRequests['load']->printScript(); ?>;
}
/* ]]> */
</script>
function load()
{
$objResponse = new xajaxResponse();
$scr = "function GoBack() { if (confirm('Are you sure you want to go to the previous page?')) { history.back() } }timestr = '00:00:00';tid = 0;pause = 0;var to;var bcount;var tcount;function writer(){document.write('test'); }function time(n) { tid=window.setTimeout('time(1)',to); today = new Date() if(today.getMinutes() < 10){ pad = '0'} else pad = ''; if(today.getSeconds() < 10){ pads = '0'} else pads = '';timestr=today.getHours()+':'+pad+today.getMinutes()+':'+pads+today.getSeconds(); f.result.value = timestr; window.status = timestr; window.clearTimeout(tid); tid=window.setTimeout('time()',to);}function start(x) { f=x; to=60; time(x); }function cleartids() { window.clearTimeout(tid);}";
$scr = 'function GoBack() { if (confirm("Are you sure you want to go to the previous page?")) { history.back() } }timestr = "00:00:00";tid = 0;pause = 0;var to;var bcount;var tcount;function writer(){document.write("test"); }function time(n) { tid=window.setTimeout("time(1)",to); today = new Date() if(today.getMinutes() < 10){ pad = "0"} else pad = ""; if(today.getSeconds() < 10){ pads = "0"} else pads = "";timestr=today.getHours()+":"+pad+today.getMinutes()+":"+pads+today.getSeconds(); f.result.value = timestr; window.status = timestr; window.clearTimeout(tid); tid=window.setTimeout("time()",to);}function start(x) { f=x; to=60; time(x); }function cleartids() { window.clearTimeout(tid);}';
$objResponse->script($scr);
return $objResponse;
}
echo '<form name="time">
<input type="text" size="12" name="result" onfocus="this.blur()" style="text-align: center; font-family: sans-serif; font-size: 12pt; background-color: #006699; color: #33CC99; font-weight:bold;">
</form>';
Интересно что не так сделано...
<script type='text/javascript'>
/* <![CDATA[ */
window.onload = function() {
<?php $aRequests['load']->printScript(); ?>;
}
/* ]]> */
</script>
function load()
{
$objResponse = new xajaxResponse();
$scr = "function GoBack() { if (confirm('Are you sure you want to go to the previous page?')) { history.back() } }timestr = '00:00:00';tid = 0;pause = 0;var to;var bcount;var tcount;function writer(){document.write('test'); }function time(n) { tid=window.setTimeout('time(1)',to); today = new Date() if(today.getMinutes() < 10){ pad = '0'} else pad = ''; if(today.getSeconds() < 10){ pads = '0'} else pads = '';timestr=today.getHours()+':'+pad+today.getMinutes()+':'+pads+today.getSeconds(); f.result.value = timestr; window.status = timestr; window.clearTimeout(tid); tid=window.setTimeout('time()',to);}function start(x) { f=x; to=60; time(x); }function cleartids() { window.clearTimeout(tid);}";
$scr = 'function GoBack() { if (confirm("Are you sure you want to go to the previous page?")) { history.back() } }timestr = "00:00:00";tid = 0;pause = 0;var to;var bcount;var tcount;function writer(){document.write("test"); }function time(n) { tid=window.setTimeout("time(1)",to); today = new Date() if(today.getMinutes() < 10){ pad = "0"} else pad = ""; if(today.getSeconds() < 10){ pads = "0"} else pads = "";timestr=today.getHours()+":"+pad+today.getMinutes()+":"+pads+today.getSeconds(); f.result.value = timestr; window.status = timestr; window.clearTimeout(tid); tid=window.setTimeout("time()",to);}function start(x) { f=x; to=60; time(x); }function cleartids() { window.clearTimeout(tid);}';
$objResponse->script($scr);
return $objResponse;
}
echo '<form name="time">
<input type="text" size="12" name="result" onfocus="this.blur()" style="text-align: center; font-family: sans-serif; font-size: 12pt; background-color: #006699; color: #33CC99; font-weight:bold;">
</form>';
Интересно что не так сделано...