Reputation: 955
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.
Upvotes: 2
Views: 2711
Reputation: 5335
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 + "¶m1" = + param1;
or
document.getElementById(navigationframe).src = document.getElementById(navigationframe).src + "¶m1" = + 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 '?')
Upvotes: 3