p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 15th, 2004, 11:31 AM
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #2 (permalink)  
Old September 15th, 2004, 01:08 PM
Friend of Wrox
Points: 2,801, Level: 22
Points: 2,801, Level: 22 Points: 2,801, Level: 22 Points: 2,801, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #3 (permalink)  
Old September 15th, 2004, 04:40 PM
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #4 (permalink)  
Old September 15th, 2004, 09:40 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: Shenzhen, GuangDong, China.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to heroman
Default

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...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #5 (permalink)  
Old September 15th, 2004, 10:57 PM
Friend of Wrox
Points: 2,801, Level: 22
Points: 2,801, Level: 22 Points: 2,801, Level: 22 Points: 2,801, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #6 (permalink)  
Old September 16th, 2004, 12:41 PM
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #7 (permalink)  
Old September 16th, 2004, 04:42 PM
Friend of Wrox
Points: 2,801, Level: 22
Points: 2,801, Level: 22 Points: 2,801, Level: 22 Points: 2,801, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #8 (permalink)  
Old September 16th, 2004, 05:09 PM
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #9 (permalink)  
Old September 16th, 2004, 08:01 PM
Friend of Wrox
Points: 2,801, Level: 22
Points: 2,801, Level: 22 Points: 2,801, Level: 22 Points: 2,801, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 :-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #10 (permalink)  
Old September 17th, 2004, 01:04 PM
Authorized User
Points: 151, Level: 3
Points: 151, Level: 3 Points: 151, Level: 3 Points: 151, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2004
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank You snib. that worked and it's wonderful.

Have a good weekend.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.Net 2.0 and JavaScript zion22 Javascript How-To 0 September 28th, 2006 02:28 PM
asp.Net 2.0 and JavaScript zion22 ASP.NET 2.0 Professional 0 September 28th, 2006 02:10 PM
javascript in asp.net Komila Generics 0 August 3rd, 2006 02:24 AM
javascript to asp.net bimboypogi ASP.NET 1.0 and 1.1 Professional 2 March 21st, 2005 02:49 AM
JavaScript in ASP.NET jbenson001 ASP.NET 1.1 0 November 15th, 2004 01:10 PM



All times are GMT -4. The time now is 03:34 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc