Как через динамическую втавку в страницу автоматически вызвать функцию javascript без обработки события?
<html><head><title>AJAX Example</title>
</head><body><center />
<h1>Loading a web page into a DIV</h1>
<div id='info'>This sentence will be replaced</div>
<script>
function Out(par)
{
alert(par);
}
// The following line has been changed to a simpler URL that
// will quickly display from within the div it is placed
params = "url=delo.pragma.ru/dss"
request = new ajaxRequest()
request.open("POST", "contrStrih.php", true)
request.setRequestHeader("Content-type",
"application/x-www-form-urlencoded")
request.setRequestHeader("Content-length", params.length)
request.setRequestHeader("Connection", "close")
request.onreadystatechange = function()
{
if (this.readyState != 4)
{
document.getElementById('info').innerHTML =
this.readyState
return
}
if (this.readyState == 4)
{
if (this.status == 200)
{
if (this.responseText != null)
{
OutText =
document.getElementById('info').innerHTML =
this.responseText
}
else alert("Ajax error: No data received")
}
else alert( "Ajax error: " + this.statusText)
}
}
request.send(params)
function ajaxRequest()
{
try
{
var request = new XMLHttpRequest()
}
catch(e1)
{
try
{
request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch(e2)
{
try
{
request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e3)
{
request = false
}
}
}
return request
}
</script></body></html>
<?php
$_mKodEAN = "
<script language=\"JavaScript\">
Out('Нет');
</script>
";
/*
$_mKodEAN .= "Добавить штрих код?";
$_mKodEAN .=
"<input type=\"button\" value=\"ДА\" onclick=\"Out('ДА');\">";
$_mKodEAN .=
"<input type=\"button\" value=\"Нет\" onclick=\"Out('Нет');\">";
$_mKodEAN .= "
<script language=\"JavaScript\">
talert(\"А это JavaScript!\")
</script>
";
*/
print($_mKodEAN);
//print "<?xml version=\"1.0\" encoding=\"windows-1251\""."?"."><body>".$_mKodEAN."</body>";
?>
в таком виде не работает (не идёт обращение к функции out), но если убрать комментарий в PHP (/**/) обрашение к OUT проходит только после нажатия на одну из кнопок
Как заставить работать Out без нажатия на кнопки?