![]() |
| Javascript OnClick |
|
jamie
HostMySite Sales Rep
![]()
|
How would I get an OnClick event in JS to act like a hyperlink? I want to make a checkbox that says "click here to make my profile private" and when someone checks it the page refreshes with a URL variable that I can detect and effect a change to my database from.
|
||||||||||||
|
|
|||||||||||||
|
bobclingan
Forum Regular
|
<input type="button" value="Click Me Baby One More Time" onClick="location.href='http://www.britneyspears.com'">
|
||||||||||||
|
|
|||||||||||||
|
ccl
|
Assuming that your check box is in a form and that the form submits to a page that updates your database and then as you indicated, returns to the form page, you can have the form submit as soon as the check box is clicked by using the Javascript Submit() method.
exammple: onclick="document.forms.formName.submit()" |
||||||||||||
|
|
|||||||||||||
|
jamie
HostMySite Sales Rep
![]()
|
Both great options - thanks guys!
|
||||||||||||
|
|
|||||||||||||
|
Connie
|
I award bobclingan extra points for presenting his example with style
|
||||||||||||
|
|
|||||||||||||
| do the same thing but change the page in a frame only |
|
scottjo
|
is there a way to do this same thing with a button but address a frame as the target? |
||||||||||||||
|
|
|||||||||||||||
|
bobclingan
Forum Regular
|
Sure, you would do something like this:
<input type="button" value="Oops I did it again!" onClick="parent.framename.location.href='http://www.britneyspears.com'"> Where framename is the name of the frame you wish to target. |
||||||||||||
|
|
|||||||||||||
| Javascript OnClick |
|
||
|



