473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

load iframe with a user-specified url

hi ppl..
i'm new to jsp and iframes.. and here is what i want to do - take
input from the user in a form, and load an iframe with that url..
any suggestions?

thx..
AB

Mar 17 '06 #1
2 2472
bh****@gmail.com said on 17/03/2006 4:20 PM AEST:
hi ppl..
i'm new to jsp and iframes.. and here is what i want to do - take

I guess you're asking how to load it directly into the iFrame without
going back to the server using JavaScript.

input from the user in a form, and load an iframe with that url..
any suggestions?


Set the location attribute of the iFrame to the value of the input text.
You may want to do some validation on the input string to make sure it
looks a bit like a URL first.

If JavaScript is disabled, the form will be submitted so have your
server return the page.

<script type="text/javascript">
function loadFrame(el)
{
var f;
var fName = el.form.target;
if (fName && (f = window.frames) && (f = f[fName])){
f.location = el.value;
return false;
}
return true;
}
</script>

<form action="" target="foo"
onsubmit="return loadFrame(this.URL);"><p>
<input type="text" size="100" name="URL"><input
type="submit" value="Load URL">
</p></form>

<iframe id="foo" name="foo" width="50%"></iframe>

Of course if you use links, you don't need script at all:

<a href="http://www.apple.com/" target="foo">Load Apple in foo</a>
--
Rob
Mar 17 '06 #2
thanks a ton, Rob.. it works fine :)

AB

Mar 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
HI! how do we load a page from the menu into an iframe when you are not on the iframe page? I want to be able to load pages (options in my menu ) into a iframe no matter if I am on the iframe...
5
by: jim.frantzen | last post by:
You have an active XMLHTTP request on the main page (localhost/App1/index.aspx) The XMLHTTP request takes about 60 seconds to receive a response back from localhost/App1/getxml.aspx. You have an...
3
by: cevatkerim | last post by:
Ok simple project! a login page with a hidden iframe when u click on submit after inserting your user and pass it pushes those values to iframe and asp query the db and returns a code if it is...
2
by: hgl1976 | last post by:
Hi! I have a web page that from a query that loads the search result into an iframe on the page. In the search result inside the iframe i would like to be able to load content into div tag that...
0
by: mrjaxon | last post by:
Basically the issue is, when the XSL style sheet is loaded by URI it is cool but when the exact same style sheet loaded by it's contents the load fails (for this particular style sheet). Because...
0
Fuhrer
by: Fuhrer | last post by:
Hi all, i have a web page(.aspx) and i have a button and an iFrame in it. What i'm trying to do is: when i click this button i want that an rpt file load into the iFrame. what i'm doing now is...
2
by: pratimapaudel | last post by:
Hi I have page LotteryResultPage.aspx . And i have one control which has two drop down and value is like this <option value="SelectStates">Select a Country</option> <option...
5
by: BerlinBrown | last post by:
Do you know if it is possible to wait for the iframe page to load and then manipulate the iframe DOM. E.g. mypage: <script> function myinit() { theiframe.location = "iframe_with_frames.html"...
2
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I have a aspx page that loads PDF files into a frame (I call an ShowFile.aspx file that uses Response.BinaryWrite). I want that the user can see div with the message loading and...
4
by: ismailc | last post by:
Hi, I need help please. I need to create a textbox with a report url in an iframe below. Onclick of button create IFrame and pass textbox value into parameter of iframe src. I'm not to sure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.