when I enter in code like this:
<p>Hello <? echo $name; ?>, How are you?</p>
It prints:
<p>Hello <!--? echo $name; ?-->, How are you?</p>
As a comment. I have it in a file called base.js with this code:
function showName() {
document.getElementById("name").innerHTML = "<p>Hello <? echo $name; ?>, How are you?</p>";
}
So I embed the .js file like so:
<script type="text/javascript" src="base.js"></script>
So, after it changes the <p id="name"></p>
I get:
<p id="name">Hello <!--? echo $name; ?-->, How are you?</p>
I had the code in the .php file, and it seemed to work fine. Now that I have it in a separate base.js file, it ceases to function. Help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…