2

I have a Iframe, and how to pass a javascript vairable to along with a iframe src.

ex:
var param1=test1;

how to pass "param1" value along with the iframe url. and i want to pass like this.

<iframe frameborder=0 src="http://cart.demo.com/c_jp.php?action=param1" name="navigationframe" id="navigationframe" width="220" height="800">

Thanks in advance.

1 Answer 1

3

If you need to pass the JS param value to the url (as you have it in your code) you can try one of the following:

window.frames[navigationframe].location = window.frames[navigationframe].location +      "&param1" = + param1;   

or

document.getElementById(navigationframe).src = document.getElementById(navigationframe).src + "&param1" = + param1;

If this is the only variable you will be "passing" to the QueryString then make sure you format the QueryString properly (if it is the second or N+1 variable prepend '&' if it is the first prepend '?')

Sign up to request clarification or add additional context in comments.

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.