The runat=“server” is the issue here. If you are trying to reload an iframe in response to a click on the page without reloading the page, then the script has to run in the browser, not on the server. Try something like this:
<iframe id="foo" src="about:blank"></iframe>
<a href="http://www.apple.com" target="foo">Apple</a>
That doesn’t need any script to work at all.
If you want to manipulate the src attribute in response to something else running in JavaScript in the browser, then the proper way to access that attribute and manipulate it is like this:
<script type="text/javascript">
var iframe = document.getElementById('foo');
iframe.src = 'whatever you want here'
</script>
You can also use JavaScript in the page to reload an iframe in response to a change in the browser’s URL, by reading and interpreting the search
and hash
portions of the window.location attribute. This can give you a magic iframe that will load a different remote document depending on a querystring or anchor attribute in the URL.
Finally, you may be running afoul of the load order of the page. When searching for an item in the page by its ID, it is critically important that the script either appear after that item in the page’s source code order, or that the script include a built-in timer that waits until the entire document has loaded (jQuery’s ready() and Protoype’s document.observe(‘dom:loaded’) callbacks, respectively).
Walter
On Oct 23, 2013, at 8:11 AM, anil wrote:
Actually i am doing this,
protected void Page_Load(object sender, EventArgs e)
{
String URL = http://www.aspforums.net/;
if (!String.IsNullOrEmpty(URL))
{
I1.Attributes["src"] = URL;
}
}
Displaying correctly,But Moble ,Tablets Not displying correctly.plz correct my code
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options