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

Problem with onclick() event

Hi all,

I have a little javascript function that assigns the value from a parent window to a field on a iframe. The function is on the parent page and its called by a button onclick() event on the other page. It works fine the first time i click on the button but if i click again the value isn't assigned anymore.

This is the function on the parent page:
Expand|Select|Wrap|Line Numbers
  1. <SCRIPT language=javascript>
  2.  
  3. function Id(){
  4.     var id = frm1.PersonId.value;
  5.     return id;
  6. }
  7.  
  8. </SCRIPT>
This is how its called on the other page:

Expand|Select|Wrap|Line Numbers
  1. <BUTTON class=MsoNavAddNew id=addRecord onclick=PersonId.value=parent.Id(); MsoTextAlign="General"></BUTTON> 
I thought an onclick() event would always work when called but perhaps not :(

Any ideias about this? Thanks in advance!
Oct 9 '06 #1
1 1460
acoder
16,027 Expert Mod 8TB
You need to refer to elements properly. Is frm1 defined properly somewhere? If not use document.forms["frm1"] to refer to the form.

Again, in the case of the onclick code, you could change it to something like:
[html]<BUTTON class="MsoNavAddNew" id="addRecord" onclick="this.form.PersonId.value=parent.Id();" MsoTextAlign="General"></BUTTON>[/html]
May 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function...
8
by: rdlebreton | last post by:
Hi, Folks! I've been trying to develop my own version of these draggable layers and I have been limiting myself to IE6...for now. I have looked at some other examples to get ideas of creating...
33
by: abs | last post by:
Hi all. My list: <ul> <li id="a" onclick="show(this)">Aaaaaaaa</li> <li id="b" onclick="show(this)">Bbbbbbbb</li> <li id="c" onclick="show(this)">Cccccccc <ul> <li id="d"...
4
by: Joerg Krause | last post by:
Hi, I've a component written in C#, and I use it in VB.NET project. The class comes with these members: MyClass.onClick ==> This is a property of type string MyClass.OnClick ==> This is an...
3
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
2
by: Marius Traelnes | last post by:
Hello! My problem is that i have validation controls on my webform but they are not "fired" because there is no "onclick" event being made on the button that should "fire" off the validation...
7
by: Shapper | last post by:
Hello, I have an ASP:ImageButton where I want to call a function and pass a string: OnClick="Change_Photo("John")" I am having problems with "". I tried
1
by: mxliron | last post by:
hi all, this code is for a picture viewer. yes, this is my first code and my first piece of programming so i maybe simply be missing some key notions here. the problem is: the nav onclick event...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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
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...

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.