Iframe URL changing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear friends,

I have an IFRAME that I want to change src url when clicking a button.

How can I change IFRAME src using button_click ?

<iframe runat="server" frameBorder=0 marginHeight=0 marginWidth=0
name=login scrolling=no src="https://localhost/default.asp"
width=150 height=97 id=myFrame></iframe>


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
myFrame.?????????= "https://localhost/login.asp"
End Sub
 
You can easily do this using Javascript on the client, instead of
server-side.

<iframe runat="server" frameBorder=0 marginHeight=0 marginWidth=0 name=login
scrolling=no src="https://localhost/default.asp" width=150 height=97
id=myFrame></iframe>
<input type="button" value="change url"
onclick="document.getElementById('myFrame').src='new url';"/>

-Kody
 
in the src="https://localhost/default.asp " part change like
src=<%=address%> the code of the page add
public string address in the declarition
and in the page load insert a wanted address you want.
and in the button click change the address value

Is there a way to do this using server-side scripting?
 
Dear Caldera,

It worked fine.

Thanks a lot.

caldera said:
in the src="https://localhost/default.asp " part change like
src=<%=address%> the code of the page add
public string address in the declarition
and in the page load insert a wanted address you want.
and in the button click change the address value

Is there a way to do this using server-side scripting?
 
Back
Top