为什么我无法在Dreamweaver中使用此脚本

时间:2015-05-15 13:48:33

标签: javascript php

我无法在php中使用此代码..我正在使用Dreamweaver

{
<SCRIPT language = "JavaScript">

var counter = 0;

// call Update function in 2 seconds after first load
ID = window . setTimeout("Update();", 2000);

function Update() {
    counter++;
    window.status = "The counter is now at " + counter;
    document.form1.input1.value = "The counter is now at " + counter;

    // set another timeout for the next count   
    ID = window . setTimeout("Update();", 2000);
}

</SCRIPT>
}

1 个答案:

答案 0 :(得分:1)

您没有输出脚本:页面需要具有用于执行JavaScript的HTML内容(通过浏览器)。 Echo你的剧本并从那里开始。

<?php
{
echo'<SCRIPT language = "JavaScript">

var counter = 0;

// call Update function in 2 seconds after first load
ID = window . setTimeout("Update();", 2000);

function Update() {
    counter++;
    window.status = "The counter is now at " + counter;
    document.form1.input1.value = "The counter is now at " + counter;

    // set another timeout for the next count   
    ID = window . setTimeout("Update();", 2000);
}

</SCRIPT>';
} ?>