2013-05-10 73 views
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Calc</title> 

<?php 
$isop = 1; 
$megp = 1; 
$mexp = 1; 
$morp = 1; 
$nocp = 1; 
$pyep = 1; 
$trip = 1; 
$zydp = 1; 
?> 
<script type="text/javascript" src="calceve.js"></script> 
</head> 
<body> 
</body> 

var iso = "<?php = $isop; ?>"; 
var meg = "<?php = $megp; ?>"; 
var mex = "<?php = $mexp; ?>"; 
var mor = "<?php = $morp; ?>"; 
var noc = "<?php = $nocp; ?>"; 
var pye = "<?php = $pyep; ?>"; 
var tri = "<?php = $trip; ?>"; 
var zyd = "<?php = $zydp; ?>"; 

JavaScript不会抓住php变量。我试图做到这一点,以便我可以在一段时间内使用JavaScript来编辑php变量,因为Eve在线价格变化,并且让javascript将php变量用于计算器中。Javascript会不会拉取php变量?

全码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Str8nge Brew Calculator</title> 

<?php 
$isop = 1; 
$megp = 1; 
$mexp = 1; 
$morp = 1; 
$nocp = 1; 
$pyep = 1; 
$trip = 1; 
$zydp = 1; 
?> 
<script type="text/javascript" src="calceve.js"></script> 
</head> 
<body> 

<table width="100%" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
    <td width="12%"><p>Isogen</p></td> 
    <td width="24%"><input type="text" id="uiso" /></td> 
    <td width="14%" id="isoq"></td> 
    <td width="50%" id="isocash"></td> 
    </tr> 
    <tr> 
    <td><p>Megacyte</p></td> 
    <td><input type="text" id="umeg" /></td> 
    <td id="megq"></td> 
    <td id="megcash"></td> 
    </tr> 
    <tr> 
    <td><p>Mexallon</p></td> 
    <td><input type="text" id="umex" /></td> 
    <td id="mexq"></td> 
    <td id="mexcash"></td> 
    </tr> 
    <tr> 
    <td><p>Morphite</p></td> 
    <td><input type="text" id="umor" /></td> 
    <td id="morq"></td> 
    <td id="morcash"></td> 
    </tr> 
    <tr> 
    <td><p>Nocxium</p></td> 
    <td><input type="text" id="unoc" /></td> 
    <td id="nocq"></td> 
    <td id="noccash"></td> 
    </tr> 
    <tr> 
    <td><p>Pyerite</p></td> 
    <td><input type="text" id="upye" /></td> 
    <td id="pyeq"></td> 
    <td id="pyecash"></td> 
    </tr> 
    <tr> 
    <td><p>Tritanium</p></td> 
    <td><input type="text" id="utri" /></td> 
    <td id="triq"></td> 
    <td id="tricash"></td> 
    </tr> 
    <tr> 
    <td><p>Zydrine</p></td> 
    <td><input type="text" id="uzyd" /></td> 
    <td id="zydq"></td> 
    <td id="zydcash"></td> 
    </tr> 
    <tr> 
    <td>--------------</td> 
    <td>--------------</td> 
    <td>--------------</td> 
    <td></td> 
    </tr> 
    <tr> 
    <td width="12%"><p>Veldspar</p></td> 
    <td width="24%"><input type="text" id="uvel" /><input type="text" id="uvel5" placeholder="Concentrated" /><input type="text" id="uvel10" placeholder="Dense" /></td> 
    <td width="14%"><p id="velq"></p><p id="velq5"></p><p id="velq10"></p></td> 
    <td id="velcash"></td> 
    </tr> 
    <tr> 
    <td><p>Scordite</p></td> 
    <td><input type="text" id="usco" /><input type="text" id="usco5" placeholder="Condensed" /><input type="text" id="usco10" placeholder="Massive" /></td> 
    <td><p id="scoq"></p><p id="scoq5"></p><p id="scoq10"></p></td> 
    <td id="scocash"></td> 
    </tr> 
    <tr> 
    <td><p>Pyroxeres</p></td> 
    <td><input type="text" id="upyr" /><input type="text" id="upyr5" placeholder="Solid" /><input type="text" id="upyr10" placeholder="Viscous" /></td> 
    <td><p id="pyrq"></p><p id="pyrq5"></p><p id="pyrq10"></p></td> 
    <td id="pyrcash"></td> 
    </tr> 
    <tr> 
    <td><p>Plaglioclase</p></td> 
    <td><input type="text" id="upla" /><input type="text" id="upla5" placeholder="Azure" /><input type="text" id="upla10" placeholder="Rich" /></td> 
    <td><p id="plaq"></p><p id="plaq5"></p><p id="plaq10"></p></td> 
    <td id="placash"></td> 
    </tr> 
    <tr> 
    <td><p>Omber</p></td> 
    <td><input type="text" id="uomb" /><input type="text" id="uomb5" placeholder="Silvery" /><input type="text" id="uomb10" placeholder="Golden" /></td> 
    <td><p id="ombq"></p><p id="ombq5"></p><p id="ombq10"></p></td> 
    <td id="ombcash"></td> 
    </tr> 
    <tr> 
    <td><p>Kernite</p></td> 
    <td><input type="text" id="uker" /><input type="text" id="uker5" placeholder="Luminous" /><input type="text" id="uker10" placeholder="Fiery" /></td> 
    <td><p id="kerq"></p><p id="kerq5"></p><p id="kerq10"></p></td> 
    <td id="kercash"></td> 
    </tr> 
    <tr> 
    <td><p>Jaspet</p></td> 
    <td><input type="text" id="ujas" /><input type="text" id="ujas5" placeholder="Pure" /><input type="text" id="ujas10" placeholder="Pristine" /></td> 
    <td><p id="jasq"></p><p id="jasq5"></p><p id="jasq10"></p></td> 
    <td id="jascash"></td> 
    </tr> 
    <tr> 
    <td><p>Hemorphite</p></td> 
    <td><input type="text" id="uhem" /><input type="text" id="uhem5" placeholder="Vivid" /><input type="text" id="uhem10" placeholder="Radient" /></td> 
    <td><p id="hemq"></p><p id="hemq5"></p><p id="hemq10"></p></td> 
    <td id="hemcash"></td> 
    </tr> 
    <tr> 
    <td><p>Hedbergite</p></td> 
    <td><input type="text" id="uhed" /><input type="text" id="uhed5" placeholder="Vitric" /><input type="text" id="uhed10" placeholder="Glazed" /></td> 
    <td><p id="hedq"></p><p id="hedq5"></p><p id="hedq10"></p></td> 
    <td id="hedcash"></td> 
    </tr> 
    <tr> 
    <td><p>Gneiss</p></td> 
    <td><input type="text" id="ugne" /><input type="text" id="ugne5" placeholder="Iridescent" /><input type="text" id="ugne10" placeholder="Prismatic" /></td> 
    <td><p id="gneq"></p><p id="gneq5"></p><p id="gneq10"></p></td> 
    <td id="gnecash"></td> 
    </tr> 
    <tr> 
    <td><p>Dark Orchre</p></td> 
    <td><input type="text" id="udar" /><input type="text" id="udar5" placeholder="Onyx" /><input type="text" id="udar10" placeholder="Obsidian" /></td> 
    <td><p id="darq"></p><p id="darq5"></p><p id="darq10"></p></td> 
    <td id="darcash"></td> 
    </tr> 
    <tr> 
    <td><p>Crokite</p></td> 
    <td><input type="text" id="ucro" /><input type="text" id="ucro5" placeholder="Sharp" /><input type="text" id="ucro10" placeholder="Crystalline" /></td> 
    <td><p id="croq"></p><p id="croq5"></p><p id="croq10"></p></td> 
    <td id="crocash"></td> 
    </tr> 
    <tr> 
    <td><p>Spodumain</p></td> 
    <td><input type="text" id="uspo" /><input type="text" id="uspo5" placeholder="Bright" /><input type="text" id="uspo10" placeholder="Gleaming" /></td> 
    <td><p id="spoq"></p><p id="spoq5"></p><p id="spoq10"></p></td> 
    <td id="spocash"></td> 
    </tr> 
    <tr> 
    <td><p>Bistot</p></td> 
    <td><input type="text" id="ubis" /><input type="text" id="ubis5" placeholder="Triclinic" /><input type="text" id="ubis10" placeholder="Monoclinic" /></td> 
    <td><p id="bisq"></p><p id="bisq5"></p><p id="bisq10"></p></td> 
    <td id="biscash"></td> 
    </tr> 
    <tr> 
    <td><p>Arkanor</p></td> 
    <td><input type="text" id="uark" /><input type="text" id="uark5" placeholder="Crimson" /><input type="text" id="uark10" placeholder="Prime" /></td> 
    <td><p id="arkq"></p><p id="arkq5"></p><p id="arkq10"></p></td> 
    <td id="arkcash"></td> 
    </tr> 
    <tr> 
    <td><p>Mercoxit</p></td> 
    <td><input type="text" id="umer" /><input type="text" id="umer5" placeholder="Magma" /><input type="text" id="umer10" placeholder="Vitreous" /></td> 
    <td><p id="merq"></p><p id="merq5"></p><p id="merq10"></p></td> 
    <td id="mercash"></td> 
    </tr> 
    <tr> 
    <td id="sub"></td> 
    <td></td> 
    <td><p>Total</p></td> 
    <td id="totalcash"></td> 
    </tr> 
</table> 
<table> 
    <tr> 
    <td></td> 
    </tr> 
    <tr> 
    <td id="sub3"></td> 
    </tr> 
</table> 
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="display:none;" id="admin"> 
    <tr> 
    <td width="12%"><p>Isogen</p></td> 
    <td width="24%"><input type="text" id="uisoa" /></td> 
    <td width="14%" id="isoqc">116.99</td> 
    <td width="50%" id="isocash"></td> 
    </tr> 
    <tr> 
    <td><p>Megacyte</p></td> 
    <td><input type="text" id="umega" /></td> 
    <td id="megqc">2029.87</td> 
    <td id="megcash"></td> 
    </tr> 
    <tr> 
    <td><p>Mexallon</p></td> 
    <td><input type="text" id="umexa" /></td> 
    <td id="mexqc">33.56</td> 
    <td id="mexcash"></td> 
    </tr> 
    <tr> 
    <td><p>Morphite</p></td> 
    <td><input type="text" id="umora" /></td> 
    <td id="morqc">6895.29</td> 
    <td id="morcash"></td> 
    </tr> 
    <tr> 
    <td><p>Nocxium</p></td> 
    <td><input type="text" id="unoca" /></td> 
    <td id="nocqc">684.26</td> 
    <td id="noccash"></td> 
    </tr> 
    <tr> 
    <td><p>Pyerite</p></td> 
    <td><input type="text" id="upyea" /></td> 
    <td id="pyeqc">11.24</td> 
    <td id="pyecash"></td> 
    </tr> 
    <tr> 
    <td><p>Tritanium</p></td> 
    <td><input type="text" id="utria" /></td> 
    <td id="triqc">5.16</td> 
    <td id="tricash"></td> 
    </tr> 
    <tr> 
    <td><p>Zydrine</p></td> 
    <td><input type="text" id="uzyda" /></td> 
    <td id="zydqc">738.98</td> 
    <td id="zydcash"></td> 
    </tr> 
    <tr> 
    <td id="sub2"></td> 
    <td></td> 
    <td></td> 
    <td></td> 
    </tr> 
</table> 

</body> 
</html> 

var iso = "<?php = $isop; ?>"; 
var meg = "<?php = $megp; ?>"; 
var mex = "<?php = $mexp; ?>"; 
var mor = "<?php = $morp; ?>"; 
var noc = "<?php = $nocp; ?>"; 
var pye = "<?php = $pyep; ?>"; 
var tri = "<?php = $trip; ?>"; 
var zyd = "<?php = $zydp; ?>"; 
alert(2); 
var vel = (1000 * tri)/333 
var sco = ((833 * tri) + (416 * pye))/333 
var pyr = ((844 * tri) + (59 * pye) + (120 * mex) + (11 * noc))/333 
var pla = ((256 * tri) + (512 * pye) + (256 * mex)) /333 
var omb = ((307 * tri) + (123 * pye) + (307 * iso))/500 
var ker = ((386 * tri) + (773 * mex) + (386 * iso))/400 
var jas = ((259 * tri) + (259 * pye) + (518 * mex) + (259 * noc) + (8 * zyd))/500 
var hem = ((212 * tri) + (212 * iso) + (424 * noc) + (28 * zyd))/500 
var hed = ((708 * iso) + (354 * noc) + (32 * zyd))/500 
var gne = ((171 * tri) + (171 * mex) + (343 * iso) + (171 * zyd))/400 
var dar = ((250 * tri) + (500 * noc) + (250 * zyd))/400 
var cro = ((331 * tri) + (331 * noc) + (663 * zyd))/250 
var spo = ((700 * tri) + (140 * pye) + (140 * meg))/250 
var bis = ((170 * pye) + (341 * zyd) + (170 * meg))/200 
var ark = ((300 * tri) + (166 * zyd) + (333 * meg)) /200 
var mer = (530 * mor)/250 
function createButton(context, func){ 
    var button = document.createElement("input"); 
    button.type = "button"; 
    button.value = "Submit"; 
    button.onclick = onClick; 
    context.appendChild(button); 
} 
function createButton3(context, func){ 
    var button = document.createElement("input"); 
    button.type = "button"; 
    button.value = "Submit"; 
    button.onclick = onClick3; 
    context.appendChild(button); 
} 
function createButton2(context, func){ 
    var button = document.createElement("input"); 
    button.type = "button"; 
    button.value = "Change"; 
    button.onclick = onClick2; 
    context.appendChild(button); 
} 
window.onload = function(){ 
    alert(3); 
    document.getElementById('isoq').innerHTML = iso; 
    document.getElementById('megq').innerHTML = meg; 
    document.getElementById('mexq').innerHTML = mex; 
    document.getElementById('morq').innerHTML = mor; 
    document.getElementById('nocq').innerHTML = noc; 
    document.getElementById('pyeq').innerHTML = pye; 
    document.getElementById('triq').innerHTML = tri; 
    document.getElementById('zydq').innerHTML = zyd; 
    alert(4); 
    document.getElementById('velq').innerHTML = vel; 
    document.getElementById('scoq').innerHTML = sco; 
    document.getElementById('pyrq').innerHTML = pyr; 
    document.getElementById('plaq').innerHTML = pla; 
    document.getElementById('ombq').innerHTML = omb; 
    document.getElementById('kerq').innerHTML = ker; 
    document.getElementById('jasq').innerHTML = jas; 
    document.getElementById('hemq').innerHTML = hem; 
    document.getElementById('hedq').innerHTML = hed; 
    document.getElementById('gneq').innerHTML = gne; 
    document.getElementById('darq').innerHTML = dar; 
    document.getElementById('croq').innerHTML = cro; 
    document.getElementById('spoq').innerHTML = spo; 
    document.getElementById('bisq').innerHTML = bis; 
    document.getElementById('arkq').innerHTML = ark; 
    document.getElementById('merq').innerHTML = mer; 
    alert(5); 
    createButton(document.getElementById('sub'), function(){ 
     highlight(this.parentNode.childNodes[1]); 
     // Example of different context, copied function etc 
     // createButton(this.parentNode, this.onclick); 
    }); 
    createButton3(document.getElementById('sub2'), function(){ 
     highlight(this.parentNode.childNodes[1]); 
     // Example of different context, copied function etc 
     // createButton(this.parentNode, this.onclick); 
    }); 
    createButton2(document.getElementById('sub3'), function(){ 
     highlight(this.parentNode.childNodes[1]); 
     // Example of different context, copied function etc 
     // createButton(this.parentNode, this.onclick); 
    }); 
    alert(5.1); 
} 
alert(6); 
function onClick(){ 
var aiso = document.getElementById('uiso').value; 
var ameg = document.getElementById('umeg').value; 
var amex = document.getElementById('umex').value; 
var amor = document.getElementById('umor').value; 
var anoc = document.getElementById('unoc').value; 
var apye = document.getElementById('upye').value; 
var atri = document.getElementById('utri').value; 
var azyd = document.getElementById('uzyd').value; 
alert(7); 
var avel = document.getElementById('uvel').value; 
var avel5 = (document.getElementById('uvel5').value * 1.05); 
var avel10 = (document.getElementById('uvel10').value * 1.1); 

var asco = document.getElementById('usco').value; 
var asco5 = (document.getElementById('usco5').value * 1.05); 
var asco10 = (document.getElementById('usco10').value * 1.1); 

var apyr = document.getElementById('upyr').value; 
var apyr5 = (document.getElementById('upyr5').value * 1.05); 
var apyr10 = (document.getElementById('upyr10').value * 1.1); 

var apla = document.getElementById('upla').value; 
var apla5 = (document.getElementById('upla5').value * 1.05); 
var apla10 = (document.getElementById('upla10').value * 1.1); 

var aomb = document.getElementById('uomb').value; 
var aomb5 = (document.getElementById('uomb5').value * 1.05); 
var aomb10 = (document.getElementById('uomb10').value * 1.1); 

var aker = document.getElementById('uker').value; 
var aker5 = (document.getElementById('uker5').value * 1.05); 
var aker10 = (document.getElementById('uker10').value * 1.1); 

var ajas = document.getElementById('ujas').value; 
var ajas5 = (document.getElementById('ujas5').value * 1.05); 
var ajas10 = (document.getElementById('ujas10').value * 1.1); 

var ahem = document.getElementById('uhem').value; 
var ahem5 = (document.getElementById('uhem5').value * 1.05); 
var ahem10 = (document.getElementById('uhem10').value * 1.1); 

var ahed = document.getElementById('uhed').value; 
var ahed5 = (document.getElementById('uhed5').value * 1.05); 
var ahed10 = (document.getElementById('uhed10').value * 1.1); 

var agne = document.getElementById('ugne').value; 
var agne5 = (document.getElementById('ugne5').value * 1.05); 
var agne10 = (document.getElementById('ugne10').value * 1.1); 

var adar = document.getElementById('udar').value; 
var adar5 = (document.getElementById('udar5').value * 1.05); 
var adar10 = (document.getElementById('udar10').value * 1.1); 

var acro = document.getElementById('ucro').value; 
var acro5 = (document.getElementById('ucro5').value * 1.05); 
var acro10 = (document.getElementById('ucro10').value * 1.1); 

var aspo = document.getElementById('uspo').value; 
var aspo5 = (document.getElementById('uspo5').value * 1.05); 
var aspo10 = (document.getElementById('uspo10').value * 1.1); 

var abis = document.getElementById('ubis').value; 
var abis5 = (document.getElementById('ubis5').value * 1.05); 
var abis10 = (document.getElementById('ubis10').value * 1.1); 

var aark = document.getElementById('uark').value; 
var aark5 = (document.getElementById('uark5').value * 1.05); 
var aark10 = (document.getElementById('uark10').value * 1.1); 

var amer = document.getElementById('umer').value; 
var amer5 = (document.getElementById('umer5').value * 1.05); 
var amer10 = (document.getElementById('umer10').value * 1.1); 
alert(8); 
var tiso = iso * aiso; 
var tmeg = meg * ameg; 
var tmex = mex * amex; 
var tmor = mor * amor; 
var tnoc = noc * anoc; 
var tpye = pye * apye; 
var ttri = tri * atri; 
var tzyd = zyd * azyd; 
alert(9); 
var tvel = vel * avel; 
var tvel5 = vel * avel5; 
var tvel10 = vel * avel10; 

var tsco = sco * asco; 
var tsco5 = sco * asco5; 
var tsco10 = sco * asco10; 

var tpyr = pyr * apyr; 
var tpyr5 = pyr * apyr5; 
var tpyr10 = pyr * apyr10; 

var tpla = pla * apla; 
var tpla5 = pla * apla5; 
var tpla10 = pla * apla10; 

var tomb = omb * aomb; 
var tomb5 = omb * aomb5; 
var tomb10 = omb * aomb10; 

var tker = ker * aker; 
var tker5 = ker * aker5; 
var tker10 = ker * aker10; 

var tjas = jas * ajas; 
var tjas5 = jas * ajas5; 
var tjas10 = jas * ajas10; 

var them = hem * ahem; 
var them5 = hem * ahem5; 
var them10 = hem * ahem10; 

var thed = hed * ahed; 
var thed5 = hed * ahed5; 
var thed10 = hed * ahed10; 

var tgne = gne * agne; 
var tgne5 = gne * agne5; 
var tgne10 = gne * agne10; 

var tdar = dar * adar; 
var tdar5 = dar * adar5; 
var tdar10 = dar * adar10; 

var tcro = cro * acro; 
var tcro5 = cro * acro5; 
var tcro10 = cro * acro10; 

var tspo = spo * aspo; 
var tspo5 = spo * aspo5; 
var tspo10 = spo * aspo10; 

var tbis = bis * abis; 
var tbis5 = bis * abis5; 
var tbis10 = bis * abis10; 

var tark = ark * aark; 
var tark5 = ark * aark5; 
var tark10 = ark * aark10; 

var tmer = mer * amer; 
var tmer5 = mer * amer5; 
var tmer10 = mer * amer10; 

var totalc = tiso + tmeg + tmex + tmor + tnoc + tpye + ttri + tzyd + tvel + tsco + tpyr + tpla + tomb + tker + tjas + them + thed + tgne + tdar + tcro + tspo + tbis + tark + tmer + tvel5 + tsco5 + tpyr5 + tpla5 + tomb5 + tker5 + tjas5 + them5 + thed5 + tgne5 + tdar5 + tcro5 + tspo5 + tbis5 + tark5 + tmer5 + tvel10 + tsco10 + tpyr10 + tpla10 + tomb10 + tker10 + tjas10 + them10 + thed10 + tgne10 + tdar10 + tcro10 + tspo10 + tbis10 + tark10 + tmer10; 
alert(11); 
document.getElementById('isocash').innerHTML = tiso; 
document.getElementById('megcash').innerHTML = tmeg; 
document.getElementById('mexcash').innerHTML = tmex; 
document.getElementById('morcash').innerHTML = tmor; 
document.getElementById('noccash').innerHTML = tnoc; 
document.getElementById('pyecash').innerHTML = tpye; 
document.getElementById('tricash').innerHTML = ttri; 
document.getElementById('zydcash').innerHTML = tzyd; 
alert(12); 
document.getElementById('velcash').innerHTML = (tvel + tvel5 + tvel10); 
document.getElementById('scocash').innerHTML = (tsco + tsco5 + tsco10); 
document.getElementById('pyrcash').innerHTML = (tpyr + tpyr5 + tpyr10); 
document.getElementById('placash').innerHTML = (tpla + tpla5 + tpla10); 
document.getElementById('ombcash').innerHTML = (tomb + tomb5 + tomb10); 
document.getElementById('kercash').innerHTML = (tker + tker5 + tker10); 
document.getElementById('jascash').innerHTML = (tjas + tjas5 + tjas10); 
document.getElementById('hemcash').innerHTML = (them + them5 + them10); 
document.getElementById('hedcash').innerHTML = (thed + thed5 + thed10); 
document.getElementById('gnecash').innerHTML = (tgne + tgne5 + tgne10); 
document.getElementById('darcash').innerHTML = (tdar + tdar5 + tdar10); 
document.getElementById('crocash').innerHTML = (tcro + tcro5 + tcro10); 
document.getElementById('spocash').innerHTML = (tspo + tspo5 + tspo10); 
document.getElementById('biscash').innerHTML = (tbis + tbis5 + tbis10); 
document.getElementById('arkcash').innerHTML = (tark + tark5 + tark10); 
document.getElementById('mercash').innerHTML = (tmer + tmer5 + tmer10); 
alert(13); 
document.getElementById('totalcash').innerHTML = totalc; 

} 
function onClick3(){ 
    var iso2 = document.getElementById('uisoa').value; 
    var meg2 = document.getElementById('umega').value; 
    var mex2 = document.getElementById('umexa').value; 
    var mor2 = document.getElementById('umora').value; 
    var noc2 = document.getElementById('unoca').value; 
    var pye2 = document.getElementById('upyea').value; 
    var tri2 = document.getElementById('utria').value; 
    var zyd2 = document.getElementById('uzyda').value; 

    iso = iso.replace(1, iso2); 
    meg = meg.replace(1, meg2); 
    mex = mex.replace(1, mex2); 
    mor = mor.replace(1, mor2); 
    noc = noc.replace(1, noc2); 
    pye = pye.replace(1, pye2); 
    tri = tri.replace(1, tri2); 
    zyd = zyd.replace(1, zyd2); 

} 
function onClick2() { 
    var e = document.getElementById('admin'); 
    var a = prompt("Password"); 
    if(a === 'admin'){ 
     e.style.display = ''; 
    } 
    else { 
     alert('Incorrect password'); 
    } 
} 
alert(14); 

回答

3

要分配变量错误的方式

var iso = "<?php = $isop; ?>"; 

使用这样

var iso = "<?php echo $isop; ?>"; 

var iso = "<?= $isop; ?>";