duangengruan2144 2012-03-05 08:31
浏览 135
已采纳

为什么在启用Javascript时不会忽略<noscript>标记内的所有内容?

Am working on an PHP application that involves multiple plans a user can select. On my Manage Plan page, whenever user selects any plan from a menu a ajax call is sent that calculates plan fee based on database values and displays it to the user. That works fine. My only problem is when Javascript is disabled everything gets messed up. Not only the plan fee doesn't show up (which is obvious) but when user clicks Submit button, the plan gets changed (ideally user should be taken to a checkout page)

Anyways, I tried putting something like this at the top of the page.

<noscript>
Javascript is disabled. Please enable it to continue.
<?php exit(); ?>
</noscript>

So when Javascript is disabled it shows a message and stops right there. But when Javascript is enabled the PHP code in <noscript> tag too gets exceuted and stops the page from running.

I am wondering when Javascript is enabled why everything inside the tag isn't ignored?

  • 写回答

9条回答 默认 最新

  • dpxo13079 2012-03-05 08:33
    关注

    PHP is rendered on the server, not on the client. the <noscript> is only regarded or disregarded by the browser. the server has no knowledge what the client will do with this tag. even HTML comments containing PHP will be executed by the page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥20 用51单片机控制急停。
  • ¥15 孟德尔随机化结果不一致
  • ¥15 在使用pyecharts时出现问题
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用