Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes onreadystatechange for div tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onreadystatechange for div tag" Watch "onreadystatechange for div tag" New topic
Author

onreadystatechange for div tag

sri pathi
Greenhorn

Joined: Jul 15, 2008
Posts: 28
Can anybody show me how to call a javascript function from a div tag event or any other javascript event which is not tied to body/form. I would like to change the style of div tag from this event. I could use only events corresponding to the div tag because I have no control over other parts of the html as it is generated by websphere portal tool.
Thanks in advance!
[ July 28, 2008: Message edited by: sri pathi ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

onreadystatechange is an Ajax event. What kind if event on a div are you talking about? mouse click? mouse over? other?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Originally posted by sri pathi:
I have no control over other parts of the html as it is generated by websphere portal tool.

Just because you can't affect the generated HTML (gotta love tools that prevent you from getting things done) doesn't mean that you can;t add event listeners to the generated elements. Can you add any script to an onload handler?
sri pathi
Greenhorn

Joined: Jul 15, 2008
Posts: 28
Originally posted by Bear Bibeault:

Just because you can't affect the generated HTML (gotta love tools that prevent you from getting things done) doesn't mean that you can;t add event listeners to the generated elements. Can you add any script to an onload handler?


I could only work with div tag. My case is like this, the tool generates a set of div tags and I want to apply different styles to only first and last div tags without any user action event like onclick, onmouseover etc. For now I have created an empty frame tag and from the onload method of the frame tag I've called the script to change the style. Just wanted to know if there is a better way of doing it. Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

I'm still not clear on what you can add to the page and what you cannot. If you can add frames, why can you not add other elements?
sri pathi
Greenhorn

Joined: Jul 15, 2008
Posts: 28
Originally posted by Bear Bibeault:
I'm still not clear on what you can add to the page and what you cannot. If you can add frames, why can you not add other elements?


Let me try to make it clear. I cannot use body tag as the tool automatically puts a body tag around my html code(i'll write a fragment/part of html). I can use most of the other tags like frame, table, iframe, div etc. I'm already using the div tag to format the look and feel of the page. What I wanted is to invoke a javascript function from this div tag (without any user action like mouse click etc. eg. onload doesnot need any user action on the page apart from visiting/loading the page). As I mentioned earlier I'm using a frame tag just to use its onload method, it has no other purpose on the html. Just wanted to know if I can do this without any extra/dummy tag.
Hope I made it clear!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: onreadystatechange for div tag
 
Similar Threads
Positioning DIVs
Table in Javascript & HTML
Help needed for an regex expression
Div Tag Width Changing si Undesireable
DOM - remove text question