D
dh
How can a button that resides on the Main page tell the child Iframes
to redirect without the page posting back? I keep getting a javascript
error: "frames.iframe1 is null or not an object." I'm assuming this is
because when i press the button it reloads the page and the frames
can't be referenced.
here's a simple example:
<HTML>
<script language="C#" runat="server">
void Submit_Click(Object Src, EventArgs E )
{
string strjscript = "<script language='javascript'>"
+ "frames[\'iframe1\'].location='http://www.google.com';"
+ "frames[\'iframe2\'].location='http://www.yahoo.com';"
+ "</script" + ">";
Response.Write(strjscript);
}
</script>
<body>
<form runat="server">
<input type="submit" Value="Update Iframes"
OnServerClick="Submit_Click" runat="server" ID="Submit"
NAME="Submit"/>
<iframe runat="server" src="about:blank" name="iframe1" ID="iframe1"
width="300" height="500" frameborder="0" scrolling="auto"></iframe>
<br>
<iframe runat="server" src="about:blank" name="iframe2" ID="iframe2"
width="300" height="500" frameborder="0" scrolling="auto"></iframe>
</form>
</body>
</HTML>
to redirect without the page posting back? I keep getting a javascript
error: "frames.iframe1 is null or not an object." I'm assuming this is
because when i press the button it reloads the page and the frames
can't be referenced.
here's a simple example:
<HTML>
<script language="C#" runat="server">
void Submit_Click(Object Src, EventArgs E )
{
string strjscript = "<script language='javascript'>"
+ "frames[\'iframe1\'].location='http://www.google.com';"
+ "frames[\'iframe2\'].location='http://www.yahoo.com';"
+ "</script" + ">";
Response.Write(strjscript);
}
</script>
<body>
<form runat="server">
<input type="submit" Value="Update Iframes"
OnServerClick="Submit_Click" runat="server" ID="Submit"
NAME="Submit"/>
<iframe runat="server" src="about:blank" name="iframe1" ID="iframe1"
width="300" height="500" frameborder="0" scrolling="auto"></iframe>
<br>
<iframe runat="server" src="about:blank" name="iframe2" ID="iframe2"
width="300" height="500" frameborder="0" scrolling="auto"></iframe>
</form>
</body>
</HTML>