Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

onreadystatechange for div tag

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onreadystatechange is an Ajax event. What kind if event on a div are you talking about? mouse click? mouse over? other?
 
Bear Bibeault
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Marshal
Posts: 67445
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!
 
Dinner will be steamed monkey heads with a side of tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic