Ready, steady… save!
You don’t need a chart to join in. Here are 2 ways to record your savings:
1. Cross it off
Pop a chart into your first post. Saved an amount? Cross it out! Read more »
£0.01 £0.02 £0.03
2. Write it down
Skip the chart and add updates to your first post. Read more »
“Another +£3 saved today. Go me!”
Use +£ before each new saving so it counts towards your total.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
ASP .Net / Javascript help needed
wheredmymoneygo
Posts: 86 Forumite
in Techie Stuff
Hi guys
Does anyone have any idea how i can open a new broswer window to a specific URL and populate some text fields in the new window.
I tried using an iframe on a page, but i kept getting an error that the frame was null, or not an object.
Any ideas?
Does anyone have any idea how i can open a new broswer window to a specific URL and populate some text fields in the new window.
I tried using an iframe on a page, but i kept getting an error that the frame was null, or not an object.
Any ideas?
0
Comments
-
This is an interesting question but, unfortunately, I do not know the answer.
I did wonder, however, whether you have tried the Microsoft ASP.NET forums in addition to this one ?
Trevor0 -
I'm just wondering if this would be of any help to you. Probably not I suspect but the site is a great resource nonetheless.
Good luck with it in any case.
Trevor0 -
Here's the Javascript to open a new window and show a new page in the window:
<script type="text/javascript">
function open_win()
{
window.open("http://www.something.com/mypage.html");
}
</script>
Does that help?0 -
I've done this at work a few years ago but cant for the life of me remember it freehand and not at work for a week :-(
I googled and got a chap asking this question:-
Link Here
Not sure you'll need all the javascript but will hopefully get you going! If you still need it in a week then PM me and will dig it out.
I have asp page (say, 1.asp) that has a textbox. This page is available
to me in read-only mode, meaning I know all the field names, functions
names etc., but can't change anything.
Now, I need to write .htm or .asp (2.htm or 2.asp) that will have a
textbox and submit button. When user clicks on submit two things have
to happen:
1) 1.asp opens in new browser window
2) textbox in 1.asp gets populated with textbox value from 2.htm (or
2.asp)
The reply was:-
as I understood the two forms (1.asp and 2.htm)
are exactly same (except button to send infos to 1.asp)
function pop() {
if(!(!truc) || !truc.closed) truc.close();
truc=window.open('1.asp','','width=300,height=250' );
txfer();
}
function txfer() { // copy content of each textbox from 2 to 1
var a = document.forms[0].elements;
var b = truc.document.forms[0].elements;
for(var i=0;i<b.length;i++) if(a.type=='text') b.value=a.value;
}
in file '2.htm' :
<input type=button onclick="pop();"
value="Open Pop-Up and Transfer Datas">
</form>
or with your case (only 1 textbox + 1 submit button)
file '2.htm' :
<html>
<script type="text/javascript">
function pop() {
var a = document.forms[0].elements[0];
if(a.value.length<1) {
alert('Fill the field of text')
a.focus(); a.select();
}
else {
if(!(!truc) || !truc.closed) truc.close();
truc=window.open('1.asp','','width=300,height=250' );
var b = truc.document.forms[0].elements[0];
b.value = a.value;
alert('that\'s done');
}
}
</script>
<form onsubmit="pop();return false;">
Name : <input type="text">
<input type="submit" value="OK">
</form>
</html>0 -
reason you may not be able to do it with an iframe could be cross domain security if yoursite is on a diff domain to one you are referencing. There are a couple of ways round it though. Also you're not trying to ref a https link are you, such as a logon form?
However, the fact you get null or not an object suggests the code is incorrect, eg iframe is not correctly referencing the parent window. Even with cross domain issue, you still still get 'object' returned if you tried to alert the name of the frame, you just wont be able to write any data.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 355.9K Banking & Borrowing
- 255K Reduce Debt & Boost Income
- 456.2K Spending & Discounts
- 248.4K Work, Benefits & Business
- 606.1K Mortgages, Homes & Bills
- 179.1K Life & Family
- 264K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.2K Discuss & Feedback
- 37.7K Read-Only Boards