|
|
 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|

September 15th, 2004, 11:31 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
javascript in asp.net
Hi,
i have whole of bunch of javascript code for the asp.net and how do i check if the javascript is enabled on the client machine...
is javascript is not enabled i just want to display a message asking them to enable javascript...
Thank U.
|

September 15th, 2004, 01:08 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Something like this....
<span id='jsEn'>
Please enable JavaScript.
</span>
<script type='text/javascript'>
document.getElementById('jsEn').innerHTML='';
</script>
HTH,
-Snib <><
There are only two stupid questions: the one you don't ask, and the one you ask more than once.
|

September 15th, 2004, 04:40 PM
|
|
Authorized User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi snib,
but how do i check if the javascript is enabled or not...
if it is disabled..the code u have given is never going to fire..so i can't use any javascript to check if javascript is enabled or disabled...propably i should do from the codebehind...
but i don't know how?
Thank You.
|

September 15th, 2004, 09:40 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Location: Shenzhen, GuangDong, China.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
you can use the ASP.NET Object Request.Browser
example:
Add A <asp:Label id="msg" runat="server" /> on your page
then
public void Page_Load(object sender,EventArgs e)
{
if(!Request.Browser.JavaScript)
{
msg.Text="You must enable the Javascript";
}
}
Study,Progress,Life...
|

September 15th, 2004, 10:57 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
pran,
If the code doesn't fire, the text "Please enable JavaScript" will still display.
-Snib <><
There are only two stupid questions: the one you don't ask, and the one you ask more than once.
|

September 16th, 2004, 12:41 PM
|
|
Authorized User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
ok cool i will try that....
well it will always show enable javascript but that is not what i want i want it to display only when javascript is disabled...
thanks for trying though
have a good day
|

September 16th, 2004, 04:42 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try this instead:
<noscript>
Enable JavaScript!
</noscript>
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once.
|

September 16th, 2004, 05:09 PM
|
|
Authorized User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
yep snib that worked..thanks alot man.
i don't know why Request.Browser.Javascript would still show true inspite of disabling the JavaScript for some reason...
but <noscript> works that's wonderful..
but all i want to do is..if javascript is not enabled i want the browser to pick an other page like javascripterror.html...
and i don't know how to do that ...
and when does Request.Browser.JavaScript actually show false bczit is true even after i disable scripting.
Thanks again snib.
Have a good day
|

September 16th, 2004, 08:01 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey pran,
Redirecting to another page would look something like this:
<noscript>
<meta http-equiv='refresh' content='0;url=http://yoursite.com/yourdirectory/yourfile.htm'/>
</noscript>
HTH!
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once :-)
|

September 17th, 2004, 01:04 PM
|
|
Authorized User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank You snib. that worked and it's wonderful.
Have a good weekend.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |