在我的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
发布评论