The moose likes HTML, CSS and JavaScript and the fly likes Problems with onClick events Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Problems with onClick events" Watch "Problems with onClick events" New topic
Author

Problems with onClick events

Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 58
Hi!
I am trying out this program where I create a button('create new button') ,on clicking this button a window is created and a table is displayed with 2 rows and 2 columns ,where each cell has a different color.On clicking any cell with a specific color the parent window gets colored by the same color.
I tried the folowing:
This creates a new window along with the table(when I click the button) but when I click on a particular cell no change occurs... Help..


AyanBiswas
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 58
here is the entire code..please help..
Jagdeep Sharma
Ranch Hand

Joined: May 24, 2010
Posts: 121

Ayan Biswas wrote:here is the entire code..please help..





use parent.window.document.bgColor
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 58
@Jagdeep Sharma I modified the code..

But stil I am stuck with the same problem.A table with each cell of different color in created but on clicking that cell no change occurs in the parent window...Am I doing the syntax part right??...with so many single and double quotes the code has become extremely clumsy...
Jagdeep Sharma
Ranch Hand

Joined: May 24, 2010
Posts: 121

Ayan Biswas wrote:@Jagdeep Sharma I modified the code..

But stil I am stuck with the same problem.A table with each cell of different color in created but on clicking that cell no change occurs in the parent window...Am I doing the syntax part right??...with so many single and double quotes the code has become extremely clumsy...




Why are you generating table on onClick. You can do one thing just make another page with this table.
Then call that page from this page. I think this problem can be on dynamic event binding. I don't know i have to check.
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 58
@Jagdeep Sharma If I do what you are saying then, when I click the 'create new window' button I will get another html page wiith the table not a window of specific size.Is that what you meant?
Jagdeep Sharma
Ranch Hand

Joined: May 24, 2010
Posts: 121

Ayan Biswas wrote:@Jagdeep Sharma If I do what you are saying then, when I click the 'create new window' button I will get another html page wiith the table not a window of specific size.Is that what you meant?






Exactly
 
 
subject: Problems with onClick events
 
developer file tools