Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 javascript question
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Freeman II
Junior Member

232 Posts

Posted - 25 June 2001 :  20:42:57  Show Profile
i have a checkbox i want to refresh the page when it;s checked or unchecked

heres what i want to do

if checkbox = checked then
refresh to URL1
else // checkbox = unchecked
refresh to URL2
end if

can someone tell me how to write this in javascript or show me an example if possible.

paco
Junior Member

Spain
187 Posts

Posted - 26 June 2001 :  03:59:43  Show Profile
try document.location='your choice url'



Edited by - paco on 26 June 2001 04:00:21
Go to Top of Page

inworg
Junior Member

Italy
153 Posts

Posted - 26 June 2001 :  04:20:32  Show Profile  Visit inworg's Homepage
quote:
i have a checkbox i want to refresh the page when it;s checked or unchecked

heres what i want to do

if checkbox = checked then
refresh to URL1
else // checkbox = unchecked
refresh to URL2
end if

can someone tell me how to write this in javascript or show me an example if possible



"Refresh" (=Reload) or "Open page..." ?
With or without parameters?



Edited by - inworg on 26 June 2001 04:21:12
Go to Top of Page

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 26 June 2001 :  04:43:27  Show Profile  Visit Kat's Homepage
Should be able to use:

window.location = 'your url'

KatsKorner
Go to Top of Page

Freeman II
Junior Member

232 Posts

Posted - 26 June 2001 :  15:42:53  Show Profile
ok thx

im a javascript beginner, can somebody help me with the if statement.
how to check if the checkbox is check or not using the if statement?

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 26 June 2001 :  15:51:57  Show Profile  Visit HuwR's Homepage

if (document.Formname.checkboxmame.checked)
window.location = URL1
else
window.location = URL2;


I think



Go to Top of Page

Dan Martin
Average Member

USA
528 Posts

Posted - 26 June 2001 :  18:09:34  Show Profile  Visit Dan Martin's Homepage  Send Dan Martin an AOL message  Send Dan Martin an ICQ Message  Send Dan Martin a Yahoo! Message

<script language=javascript>
function letsGo() {
if (myForm.myCheckbox.checked) {
myForm.action="url1.asp";
} else {
myForm.action="url2.asp";
}
myForm.submit();
}
</javascript>

<form name=myForm method=post>
<input type=checkbox name=myCheckbox>
<input type=button value="Let's go" onClick="letsGo();">
</form>


Edited by - Dan Martin on 26 June 2001 18:16:19
Go to Top of Page

Freeman II
Junior Member

232 Posts

Posted - 26 June 2001 :  20:10:10  Show Profile
thanks for ur help

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07