是否可以调用此函数来使用PHP打印文档?使用PHP调用Javascript函数
这里是我的代码家伙..
<html>
<head>
<script language="javascript">
function Clickheretoprint()
{
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting+="scrollbars=yes,width=900, height=700, left=100, top=25";
var docprint=window.open("","",disp_setting);
docprint.document.open();
docprint.document.write('<html><head><title>Testing</title>');
docprint.document.write('</head><body onLoad="self.print()" style="width: 900px; height="auto" font-size:16px; font-family:arial;">');
docprint.document.write('<h1>Hello World!</h1>');
docprint.document.write('</body></html>');
docprint.document.close();
docprint.focus();
}
</script>
</head>
<body>
</body>
</html>
谢谢。
窗口只需添加一个调用该函数 – j08691
你不“从PHP调用JavaScript的”您“包括一个JavaScript函数调用在你的输出中“。 PHP是一种服务器端语言。 Javascript是一种客户端(浏览器)语言。浏览器和服务器可以进行通信,但不能相互调用某个功能。 – mertyildiran
它不会工作先生..我曾尝试更改aler(“你好世界”)的功能;并添加一个PHP代码来回声clickheretoprint(),它的工作原理..我想知道为什么它不在这个代码工作.. T_T – Adrian