检查是否启用了Javascript

编程入门 行业动态 更新时间:2024-10-23 20:27:37
本文介绍了检查是否启用了Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的Web应用程序中,我想检查是否在客户端浏览器中启用了Javascript.怎么做? 在此先谢谢您

In my web application, I want to check wheather Javascript is enabled in the client browser or not. How to do it? Thanks in advance

推荐答案

看看此处 [ ^ ],它会有所帮助.像这样的链接很少: 类似链接1 [ ^ ] 类似链接2 [ ^ ] Have a look here[^], it would help. Few links like: Similar link 1[^] Similar link 2[^]

简单.使用标签. 在此处查看 NoScript标签信息 Simple. Use the tag. Check it out here NoScript Tag Info

您可以尝试以下标记附带代码. You can try the following markup side code. <script type="text/javascript"> function checkJavaScriptValidity() { document.getElementById("Enabled").style.visibility = 'visible'; document.getElementById("Disabled").style.visibility = 'hidden'; } </script>

head 标记内编写函数. 现在,从 body onload 调用该函数.类似于以下内容: < body onload ="checkJavaScriptValidity()"> 然后创建两个div(在form标记内)以在浏览器上显示消息.请按照以下代码进行操作:

Write the function within the head tag. Now call the function from body onload. like the following: <body onload="checkJavaScriptValidity()"> And Now create two div(within the form tag) to show the message on your browser.Please follow the code below:

<div id="Enabled" style="visibility: hidden"> Ya Browser JavaScript is enabled.have fun!! </div> <div id="Disabled"> Browser JavaScript is disabled. Please Check the Browser Setting. </div>

如果您想知道,浏览器是否支持javascript.您可以使用以下代码:

If you want to know that, the browser supports the javascript or not. You can use the following code:

if (Request.Browser.JavaScript) { Response.Write("Javascript Enabled") ; } else { Response.Write("Javascript Disabled") ; }

如果这对您真的很有帮助,请不要忘记投票并接受答案.

If this would be really helpful to you then don''t forgot to Vote and Make Answer as Accepted.

更多推荐

检查是否启用了Javascript

本文发布于:2023-11-01 01:22:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547836.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!