What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » JavaScript help

JavaScript help
Author: Message:
lordy
Senior Member
****


Posts: 853
Reputation: 24
35 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. JavaScript help
I'm trying to make a function that displays a confirm box when someone clicks on the 'submit' button of a form, then if they click ok it submits the form and if they click cancel it resets it. atm i have this:
code:
function submit_form(id) {
    var formid = getElem(id);
    if (confirm("blah")) {
    formid.submit();
    }
    else {
    formid.reset();
    }
}

But it doesn't display the confirm box at all :( can anyone help? :P
05-29-2006 12:12 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: JavaScript help
[/code]function deletePost(pid) {
    confirmReturn = confirm("Are you sure you want to delete this post?");
    if(confirmReturn == true) {
        window.location = "editpost.php?action=quickdelete&pid="+pid;
    }
}[/code]

taken from http://shoutbox.menthix.net/general.js
05-29-2006 12:50 AM
Profile E-Mail PM Find Quote Report
lordy
Senior Member
****


Posts: 853
Reputation: 24
35 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. RE: JavaScript help
hmm. i now have:
code:
function submitForm(id) {
    var formId = getElem(id);
    var confSub = confirm("Test");
    if(confSub == true) {
        formId.submit();
    }
    else {
        formId.reset();
    }
}

btw getElem() is:
code:
function getElem(id) {
    var divid = document.getElementById(id);
    return divid;
}
and I have:
code:
<form id="hostsu" method='POST'>
<<form here>>
<input type="button" onclick="submitForm('hostsu');" value="Submit">
Clicking the button just does nothing...

This post was edited on 05-29-2006 at 01:26 AM by lordy.
05-29-2006 01:20 AM
Profile E-Mail PM Find Quote Report
lordy
Senior Member
****


Posts: 853
Reputation: 24
35 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. RE: JavaScript help
ok nvrmind, it works fine :P

I had it looking for the wrong js file 8-)
05-29-2006 01:31 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On