0

Well, to put it simply, this doesn't work:

<script>
alert("You are about to send email to the client! Do you want to proceed?");
var frame = document.getElementById("iframeMailer");
frame.src="qr.php";
</script>

When the user presses okay, the source of the iframe does not load.

It is by the way defined as follows:

<iframe src="example.php" height=130 width=50% frameBorder="0" seamless name="iframeMailer" id="iframeMailer"></iframe>
4

2 Answers 2

0

You must put javascript before tag "body"

<script>
alert("You are about to send email to the client! Do you want to proceed?");
var frame = document.getElementById("iframeMailer");
frame.src="qr.php";
</script>
</body>
Sign up to request clarification or add additional context in comments.

Comments

0

First of all, Use confirm instead of alert because alert cannot receive input from the user. Your code should be something like

<script>
    function queryFrame () {
        var frame = document.getElementById("iframeMailer");
        if (confirm("You are about to send email to the client! Do you want to proceed?")) {        
            frame.src="qr.php";
        }
    }

    window.addEventListener("DOMContentLoaded", queryFrame())
</script>

And the HTML:

<iframe height=130 width=50% frameBorder="0" seamless name="iframeMailer" id="iframeMailer"></iframe>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.