将值写入页面而不出现在源代码中

时间:2011-06-18 09:46:18

标签: javascript html5

我想知道是否有人能告诉我如何实现以下目标。我正在查看Digitalstormonline自定义系统构建界面,并注意到它们的价格在萤火虫中没有任何痕迹地更新。

http://www.digitalstormonline.com/comploadhailstorm.asp?id=477406

包含更新价格的输入代码不包含更新价格的线索。我知道价格是在服务器端计算的,但他们如何能够以不涉及在源代码中编写数字的方式更新数字?

感谢

3 个答案:

答案 0 :(得分:1)

他们在HTML源代码中包含JavaScript中的所有信息:

networkcards[1] = new Array()
networkcards[1][0] = "Wireless-PCI N 300Mbps (Supports 802.11n/g/b) <b>[+$49]</b>";
networkcards[1][1] = "49";
networkcards[1][2] = "9030";
networkcards[1][3] = "/control/images/thumbCONF9030.jpg";
networkcards[1][4] = "&nbsp;";
networkcards[1][5] = "";
networkcards[1][6] = "";


networkcards[2] = new Array()
networkcards[2][0] = "Wireless-USB N 300Mbps (Supports 802.11n/g/b) <b>[+$49]</b>";
networkcards[2][1] = "49";
networkcards[2][2] = "9031";
networkcards[2][3] = "/control/images/thumbCONF9031.jpg";
networkcards[2][4] = "&nbsp;";
networkcards[2][5] = "";
networkcards[2][6] = "";


networkcards[3] = new Array()
networkcards[3][0] = "!PROMOTION: Killer 2100 (Optimized for Online Gaming) Lag and Latency Reduction <b>[+$99]</b>";
networkcards[3][1] = "99";
networkcards[3][2] = "9119";
networkcards[3][3] = "/control/images/thumbCONF9119.jpg";
networkcards[3][4] = "&nbsp;";
networkcards[3][5] = "Features";
networkcards[3][6] = "100";

多维数组的元素[1]包含价格信息。

答案 1 :(得分:1)

该值已在客户端更新,但您认为没有变化这一事实非常标准。 Javascript更改了不一定会改变DOM的值(你所谓的源代码,或者你在firebug中看到的内容),但是如果你在自定义价格并执行后打开firebug控制台,那就没有什么神奇之处了: / p>

$('#divStayTopLeft input').val();

您将看到更新后的值。

您可以简化整个过程,并使用简单的小提琴:http://jsfiddle.net/wexTS/

源头开始为 <input id="foo" value="bar" /> 这就是改变后它在firebug中的样子,但显然值变为fooooo

类似的问题:jQuery - selected attribute on options doesn't show in FireBug

答案 2 :(得分:0)

实际上,它是在源代码中编写的,并在客户端计算。

从第178行开始:

//CORE******8888
// CASES
var cases;
cases = new Array; 

cases[0] = new Array()
cases[0][0] = "Special Deal Hot Seller - Black OPS HailStorm Edition";
cases[0][1] = "421";
cases[0][2] = "8357";
cases[0][3] = "/control/images/thumbCONF8357.jpg";
cases[0][4] = "&nbsp;"; //selected item
cases[0][5] = ""; //selected item
cases[0][6] = ""; //selected item

...(依此类推)