开发者

return a value in javascript help needed

开发者 https://www.devze.com 2023-03-05 21:08 出处:网络
I have this line of code: <a href=\"#\" id=\"profilelink\" name=\"link2\" onClick=\"viewornot(<?php echo $freechat_id ?>)\"><?php echo $freechat_list; ?></a>

I have this line of code:

<a href="#" id="profilelink" name="link2" onClick="viewornot(<?php echo $freechat_id ?>)"><?php echo $freechat_list; ?></a>
<!-- call the JS onclick and if OK was click do the message box and send button here -->

Then I have my JS:

function viewornot(id) {
    var e = confirm('Do you want to view this profile?');
    if (e == true) {
        window.location.href = "http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id=" + id;
        window.location('http://www-rainbowcode-net/apps_dev.php/profiles/showprofilepersonal?id=' + id);
        return true;
    }
    else {
        var e2 = confirm('Do you wa开发者_StackOverflow社区nt to send a message?');
        if (e2 == true) {
            //if ok was clicked send value back?? 
            return e2;  
        }
    }
}

on the e2 confirm: if I clicked OK how can I send a value back(so that I know OK was clicked) so that I can then produce the message box and send button and do the rest of the code to send a message?


Change onClick="viewornot(...)" to onClick="return viewornot(...)".

0

精彩评论

暂无评论...
验证码 换一张
取 消