Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a re-direct from an Okay Cancel Button 1

Status
Not open for further replies.

murphyhg

Technical User
Mar 1, 2006
98
0
0
US
I am just not familiar enough with Javascript to get this to work. I have a radio button that displays an ok & cancel button when you click on the radio button. I want to send the client to another HTML page when they click okay. If they click cancel I want them to stay on the page. Here is my code.

<script>
<!--
function GP_popupConfirmMsg(msg) { //v1.0
document.MM_returnValue = confirm(msg);
If (document.MM_returnValue == 'true'){
window.location = 'altsurvey.cfm';
}

//-->
</script>
 
try this:

Code:
function GP_popupConfirmMsg(msg) {
    if ( confirm(msg) ) {
        window.location = 'altsurvey.cfm';
    }
}

is this what you're looking for?



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Try like this:
Code:
function GP_popupConfirmMsg(msg) { //v1.0
  If (confirm(msg)){
    window.location = 'altsurvey.cfm';
  }
}
 
I tried what you suggested however I get a Javascript error message right off. It says expected ;

Here is my code.

<script>
<!--
function GP_popupConfirmMsg(msg) { //v1.0
document.MM_returnValue = confirm(msg);
If (confirm(msg)) {
window.location = 'altsurvey.cfm';
}
}
//-->
</script>

<input onClick="GP_popupConfirmMsg('You have indicated that you personally do not ever use CPS. Please confirm this statement now by clicking okay. By confirming this statement, you will be directed immediately to the last two questions on the survey and will not be able to provide further feedback to us about CPS in this survey.');return document.MM_returnValue" name="Question6" type="radio" value="0" <cfif form.question6 EQ 0>Checked</cfif>>

When I check for the values of document.MM_returnValue in an alert box I get true for okay and false for cancel.
 
Case sensitive if. It's my fault for copying your code without looking.
Code:
function GP_popupConfirmMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
if (document.MM_returnValue) {
window.location = 'altsurvey.cfm';
    }
}
 
He used my code, though they were nearly identical save the botched if. But I figured, since he seemed to want to use it, that he might want the value for somewhere else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top