dthh5038 2013-08-30 12:07
浏览 26

我可以将Javascript条件的结果导入PHP变量吗?

Language : PHP & Javascript
I am maintaining a site in which I have two CSS, one for screen width less than 1024 and other for screen width greater than 1024. I use to match CSS by checking screen width in Javascript as follows.

var one=screen.width;
if(screen.width<1024)
document.getElementById('cs')='one.css';
else
document.getElementById('cs')='two.css';

Now I want the result of this if condition to be stored to a session variable in PHP. How can I implement this and is this really possible? Someone please help me out.

Thanks.

  • 写回答

4条回答 默认 最新

  • doumei8258 2013-08-30 12:09
    关注

    No. JavaScript is a client-side language, and PHP is a server-side language. By the time your JavaScript is parsed, PHP has been and gone.

    评论

报告相同问题?

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab