function if javascript enabled, else postback

G

Guest

Hi;

When a user clicks a radio button, what I would like to do is that if
javascript is enabled on their browser, it calls a javascript function and
does not do a postback. If javascript is disabled, then it does do a postback.

Is there a way to do this?
 
G

GregG

David Thielen said:
Hi;

When a user clicks a radio button, what I would like to do is that if
javascript is enabled on their browser, it calls a javascript function and
does not do a postback. If javascript is disabled, then it does do a postback.

Is there a way to do this?

Well, you could capture the OnSubmit event for the form and handle it
there with client side code... return true or false to allow or
disallow the browser to post.

FWIW,

Greg G.
 
J

John Timney \( MVP \)

Detect if javascript is enabled using Request.Browser.JavaScript before you
output the actual page contianing the radiobutton and change your output
accordingly if its not so the javascript function cannot be called.
 
G

Guest

Hi;

I may be missing something. If javascript is disabled, then the onsubmit
function won't be called - correct?
 
B

Bob Lehmann

Doesn't that just detect if the browser supports JavaScript, not that the
user allows it?

Bob Lehmann
 
G

GregG

David Thielen said:
Hi;

I may be missing something. If javascript is disabled, then the onsubmit
function won't be called - correct?

Nope - Or Yep... ;-)


Greg G.
 
J

Juan T. Llibre

Yes.

I believe the *only* way to detect whether a client has Javascript
enabled is to actually send a Javascript test variable to the client.

If the variable is found, the client has Javascript enabled.
If it doesn't, it doesn't.

I've seen a really "tricky" way to do that with an invisible frame.
 
G

Guest

Ok, so much for being elegant and falling back if it's not turned on.

I'm going to go for the brute force approach, they must have it on and I put
a <noscript>Please turn on javascript to use this site.</noscript> at the top
of my page.
 
B

Bruce Barker

if javascript is disabled, the only way to do postback is for the user to
click a submit button, or type enter.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top