0

On my website I wrote a function like this:

function apri(dat) {
document.getElementId('dado').src= dat;
}

and the iframe HTML code is the following.

<iframe id="dado"src="http://mk7vrlist.altervista.org/" width="100%" height="700px" scrolling="yes" frameBorder="0">
  Your browser doesn't load this iframe.
</iframe>

I call the apri() function in this way:

<p onclick="apri(http://mk7vrlist.altervista.org/other/staffpage.html)"> <img src="/pictures/uno.png" /> Staffers</p>

The content of my iframe is not changing. I've googled this a lot but I didn't find any solution. What can I do?

Do you think I should use something different instead of the iframe?

1
  • You have 'getElementId'. Did you mean 'getElementById' ? Commented Aug 28, 2013 at 12:59

1 Answer 1

4

Check your error console after you click the text. You will see an error message.

SyntaxError: missing ) after argument list

The bug is quoting problem. You have a string with no quotes around it.

<p onclick="apri('http://mk7vrlist.altervista.org/other/staffpage.html')">
                 ^                                                    ^
              missing                                               missing
Sign up to request clarification or add additional context in comments.

1 Comment

I found another error I made. If you look at apri() I wrote 'document. getElementId ('dado').src=', It should be getElementById. Add this in the answer, it could help other users ;)

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.