Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Checkbox Question ????

11 views
Skip to first unread message

tiglath

unread,
Feb 4, 2002, 12:07:42 PM2/4/02
to

This is want I want to do:

I have links (just underlined text with link and target specified) on
a navigation bar inside a frame, and a checkbox. If the text box is
clicked the new page is displayed in a new browser window, if not in
the central frame.

The problem is that I cannot get the status of the checkbox without
submitting the form. Clicking the links don't submit the form. It
seems I have to change the links into submit buttons, but I'd prefer
not to do that.

What is the sensible way of doing this? The links could call a page
that determines whether the checkbox is selected or not and the call
the right page accordingly.

I am using Windows 2000 and IIS.

Ideas, recommendations, and examples appreciated.

Many thanks.


sebp

unread,
Feb 4, 2002, 12:24:00 PM2/4/02
to
"tiglath" <tig...@usa.net> wrote in message
news:a3mf62$n61$1...@bob.news.rcn.net...

A link to your page would be helpful!

I think a short javascript would help, where you test the checkbox status
when clicking on your link.

But I think you can get better solvings with the link posted.

-sebp-


tiglath

unread,
Feb 4, 2002, 2:28:11 PM2/4/02
to

"sebp" <webpr...@t-online.de> wrote in message
news:a3mgfg$s8s$03$1...@news.t-online.com...

Sorry not possible yet.

>
> I think a short javascript would help, where you test the checkbox
status
> when clicking on your link.

How?

Is there an onclick event that on clicking the checkbox a script could
run to set a variable in the server?

Alternatively, as you suggest how can one get a script to run on
clicking a link and how is the status checked. The document object,
perhaps?

Thanks for taking the time to reply.

Ang Talunin

unread,
Feb 4, 2002, 3:46:58 PM2/4/02
to
I think this will work...it works with me....:-)

<html>

<head>

<script>
function Function(){
if (eval("document.formbox.group.checked") == true){
document.location="http://www.yoursite.com"}
if (eval("document.formbox.group.checked") == false){
window.open("http://www.yoursite.com");}

}
</script>

</head>

<body>

<form name="formbox">
<input type = "radio" name="group">
<a href onClick=Function()> LINK </a>

</form>

</head>
</html>


Good luck with it,

greetings

Ang Talunin

Ang Talunin

unread,
Feb 4, 2002, 4:03:09 PM2/4/02
to

> I think this will work...it works with me....:-)
>
> <html>
>
> <head>
>
> <script>
> function Function(){
> if (eval("document.formbox.group.checked") == true){
> document.location="http://www.yoursite.com"}
> if (eval("document.formbox.group.checked") == false){
> window.open("http://www.yoursite.com");}
>
> }
> </script>
>
> </head>
>
> <body>
>
> <form name="formbox">
> <input type = "radio" name="group">

// works of course also with "checkbox"

> <a href onClick=Function()> LINK </a>
>
> </form>
>
> </head>

// to fast...has to be </body>, it works anyway, but just for the right
script

Jukka K. Korpela

unread,
Feb 4, 2002, 5:52:01 PM2/4/02
to
"tiglath" <tig...@usa.net> wrote:

> I have links (just underlined text with link and target specified) on
> a navigation bar inside a frame, and a checkbox. If the text box is
> clicked the new page is displayed in a new browser window, if not in
> the central frame.

You could peek at Mikodocs (great resource on HTML &Co., by the way) to
see how they do it:
http://www.idocs.com/tags/quicklist.html

It has some extra complications, since it tries to preserve the user's
selection via cookies. But the basic logic is to have some JavaScript
code executed so that a form containing a checkbox is generated - it
would clearly be misleading to have a checkbox when JavaScript is off -
and set variable when the user checks the checkbox. And the links on the
page then have onclick="if(...) newwin(this)" where the condition tests
for that variable.

That particular code is for letting the user check a box if he wants all
links to open in a new window. If you'd like to make it open links in the
full window, then the onclick code should be modified so that it
conditionally opens a page (naturally, the same as in href) in the
desired way and performs return false to prevent normal link processing.

Followups trimmed. Hint: The average usefulness of a thread is inversely
proportional to the cube of the number of groups it is posted to.
(Korpela's 42nd law.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


DRN

unread,
Feb 4, 2002, 6:38:29 PM2/4/02
to
In article <Xns91AC85B12E47...@193.229.0.31>, Jukka K.
Korpela <jkor...@cs.tut.fi> wrote...

>
> Followups trimmed. Hint: The average usefulness of a thread is inversely
> proportional to the cube of the number of groups it is posted to.
> (Korpela's 42nd law.)
>
>

What are the other 41? (I couldn't find them on your site)


Cheers, Donald
--
http://www.drnoble.co.uk donaldrnoble at yahoo dot com
--
http://www.AccessibleComputers.co.uk
Hardware, Software & Custom built PC Systems

tiglath

unread,
Feb 5, 2002, 9:55:02 AM2/5/02
to

Thank you all.

I have tried something along these lines and works fine to set the
NewWindow session variable when I click the checkbox.

A new problem is that I am getting a "Object required" error for the
line "window open" :

when I click on a link

<A href="dispatch.asp?customers.htm" target=mainFrame>Customers</a>

And in dispatch.asp:

<% @Language=VBScript>
<%
page = Request.QueryString
if session("NewWindow") = "True" then
window.open page
else
response.redirect page
end if
%>

Why?

Many thanks


"Ang Talunin" <psych...@hotmail.com> wrote in message
news:a3mrtk$303e$1...@news.kabelfoon.nl...

Ang Talunin

unread,
Feb 5, 2002, 11:03:05 AM2/5/02
to
Not sure, please enter your total pagescript and what you exactly want to
do....

tiglath <tig...@usa.net> schreef in berichtnieuws
a3oroj$5em$1...@bob.news.rcn.net...

tiglath

unread,
Feb 6, 2002, 12:46:44 PM2/6/02
to

I want to open a page on its own window or in the main frame depending
on whether a check box in the navigation bar is checked or not. Why
this doesn't work?

Any ideas?

Many thanks


-----

<html>
<head>
<SCRIPT>

function dispatch(page) {
if (document.form1.checkbox.checked)
window.open(page);
else
document.location=page;
}

</SCRIPT>
</head>

<body>

<a href='#' onclick="dispatch("+""""+
"customers.htm"+""""+")">Customers</a>

<form name="form1">
<INPUT type=checkbox name="checkbox">
</form>

</body>
</html>


Jukka Korpela

unread,
Feb 6, 2002, 1:58:52 PM2/6/02
to
DRN <donald...@please.see.sig> wrote:

>> Followups trimmed. Hint: The average usefulness of a thread is
>> inversely proportional to the cube of the number of groups it is
>> posted to. (Korpela's 42nd law.)
>
> What are the other 41? (I couldn't find them on your site)

Wait a minute... I do have them somewhere... oh yes:
http://www.cs.tut.fi/~jkorpela/usenet/laws.html

ObDHTML: If you're using IE with JScript enabled, don't click on
anything on that page.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Ang Talunin

unread,
Feb 6, 2002, 2:10:55 PM2/6/02
to

tiglath <tig...@usa.net> schreef in berichtnieuws
a3rq6n$1uu$1...@bob.news.rcn.net...

>
>
> I want to open a page on its own window or in the main frame depending
> on whether a check box in the navigation bar is checked or not. Why
> this doesn't work?
>
> Any ideas?
>
> Many thanks
>
>
> -----
>
> <html>
> <head>
> <SCRIPT>
>
> function dispatch(page) {
> if (document.form1.checkbox.checked)
> window.open(page);
> else
> document.location=page;
> }
>
> </SCRIPT>
> </head>
>
> <body>
>
> <a href='#' onclick="dispatch("+""""+
> "customers.htm"+""""+")">Customers</a>

// What are you trying to do wiht this?
You can NEVER use " like this. If you, you first open with the first " and
close it directly with the second ". So instead of " you should at least use
'.

Ang Talunin

unread,
Feb 6, 2002, 2:20:35 PM2/6/02
to
So you should try this:

Ang Talunin
---

<html>
<head>
<SCRIPT>

function dispatch(page) {
if (eval("document.form1.checkbox.checked")== true)
window.open(page);
else
document.location=page;
}

</SCRIPT>
</head>

<body>

<form name="form1">
<INPUT type=checkbox name="checkbox">
<a href onClick=dispatch("http://www.altavista.com")>Customers</a>
// or you can use your own url, as long as it is complete, wiht http://
etc...
</form>

</body>
</html>

tiglath

unread,
Feb 6, 2002, 4:22:41 PM2/6/02
to

Thank you very much for taking the time.

I have made it work with a combination of single and double quotes and
without the eval():

function dispatch(page) {
if (document.form1.checkbox.checked)
window.open(page);
else
document.location=page;
}

and for the link

<a href ='#' onclick='dispatch("customers.htm")'>Customers</a>


It works now.

Much obliged too all.


"Ang Talunin" <psych...@hotmail.com> wrote in message

news:a3rvja$2gjs$1...@news.kabelfoon.nl...

0 new messages