473,382 Members | 1,442 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,382 software developers and data experts.

Trigger a function from pop up window and arguments question...

Hi,

I have a main page that opens a pop up window when the user clicks a
link. The pop up window is a menu and when the user clicks the item, it
populates a form input element on the 'parent' window.

My question is: this new populated form element is the value that I use
to change a style.

onchange does not watch this form element because of getelementbyid, so
it doesn't trigger the function needed to change the style. onchange
works fine if I just manually input a value into the text box.

Any other way to fire the function off when the user picks their
selection from the pop-up window? I was thinking I could use
window.opener.function()? But how do I pass the form from the parent
window? From the pop up window, I don't use this.form, what do I
use?something like window.opener.form[0] ?

thks

Aug 14 '06 #1
2 3884
Sally B. написав:
onchange does not watch this form element because of getelementbyid, so
it doesn't trigger the function needed to change the style. onchange
works fine if I just manually input a value into the text box.
Input value into the text box by code and then explicitly call function
which you use as onchange event handler.
window? From the pop up window, I don't use this.form, what do I
use?something like window.opener.form[0] ?
opener is ahother window and it has no "form" property, use
opener.document.form[0].

But better you can define a function in the main window and call it
from a popup window.
e.g.

main window

<html>
<body>
<script type=text/javascript>
function foo(val){
document.getElementById("tb1").value = val;
tb1Changed(val);
}
function tb1Changed(val){
alert("textbox value: " + val);
}
</script>
<input type=button
onclick="window.open('2.htm','popup','height=300,w idth=300');"
value="Open popup window">
<input type="text" id="tb1" onchange="tb1Changed(this.value)">
</body>
</html>
popup window

<html>
<body>
<input type=button onclick="opener.foo('test');" value="Change main
window">
</body>
</html>

Aug 14 '06 #2
Thanks for the response. I will try this out...

Aug 15 '06 #3

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

Similar topics

8
by: Mark English | last post by:
I'd like to write a Tkinter app which, given a class, pops up a window(s) with fields for each "attribute" of that class. The user could enter values for the attributes and on closing the window...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: Jules Alberts | last post by:
Hello everyone, Several columns in sereval tables in my DB should always be lowercase. I now have a simple function: create or replace function code_lower() returns trigger as ' begin...
2
by: Karl O. Pinc | last post by:
I'm sure I saw something like this on the postgresql web site but the the search function is down in the documentation area. I'm unable to pass a function arguments in a CREATE TRIGGER...
26
by: Patient Guy | last post by:
The code below shows the familiar way of restricting a function to be a method of a constructed object: function aConstructor(arg) { if (typeof(arg) == "undefined") return (null);...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
1
by: djdevx | last post by:
Dear all PostgreSQL xperts! Hi, I am newbie in PostgreSQL. I am currently developing an app that use PostgreSQL as a BackEnd Database. Now I am having problem with the function trigger since last...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.