Loading ...
Sorry, an error occurred while loading the content.
 

Re: [JavaScript] (another) checkbox problem... :(

Expand Messages
  • i980365
    Hi david. the id parameter is the id of a SVG layer, but that s not the problem. here is my hiliteElement function: function hiliteElement(checkbox, layerId) {
    Message 1 of 2 , Aug 6, 2003
      Hi david.

      the id parameter is the id of a SVG layer, but that's not the problem.
      here is my hiliteElement function:

      function hiliteElement(checkbox, layerId)
      {
      svgdoc = parent.document.getElementById("mapasvg").getSVGDocument();
      var v = checkbox.checked ? "visible" : "hidden" ;
      svgdoc.getElementById(layerId).getStyle().setProperty('visibility',
      v );
      }

      this function works fine, I´ve tested it before (with static
      content) ...

      I found out that, when creating elements dinamically (using
      createElement), the events associated to them don't work!!! Maybe a
      browser problem, I don´t know... I´ve tried to do it with another
      objects (buttons, for example...), and with another events
      (onmouseover, onmouseout), and I've got the same result.

      innerHTML only works in IE, right? :(

      But I have solved my problem, I'm not using javascript to do that
      anymore... I create a iframe element, the src atribute is a JSP page.
      That page creates all checkboxes that I need, and this works fine.


      Once again, thanks for your help.
      Best regards,
      [i980365]



      --- In javascript_official@yahoogroups.com, "David Smart"
      <smartware@o...> wrote:
      > I'm a bit uneasy about the inclusion of "id" as a quoted
      parameter. What's in it?
      >
      > Best way to check what this is doing is to pop the information into
      an alert call and see if it looks right. I.e.
      >
      > alert("hiliteElement(this,'" + id + "')") ;
      >
      > However, also look at this link
      http://www.faqts.com/knowledge_base/view.phtml/aid/9592 which gives a
      workaround for IE5.5 - don't know if it applies to IE6.
      >
      > I did a Google search for 'setattribute onclick' (without the
      quotes) and got quite a few hits - but there's a lot of confusion.
      >
      > Hope this helps. (I don't use createElement much, so am a bit in
      the dark myself. I just tend to write the HTML out, and use
      innerHtml calls where necessary.)
      >
      > Regards, David Smart
      >
      > SmartWare Consulting
      > smartware@o...
      > http://members.optushome.com.au/smartware/
      >
      > ----- Original Message -----
      > From: i980365
      > To: javascript_official@yahoogroups.com
      > Sent: Tuesday, August 05, 2003 1:53 AM
      > Subject: [JavaScript] (another) checkbox problem... :(
      >
      >
      > Hi all.
      >
      > I have the following problem:
      > when I click on a checkbox (created with javascript), the
      function
      > associated with that event (onclick) isn't executed...
      >
      > I've tried with static content, and it works!!!
      > can't understand why it doesn't work when creating checkboxes
      > dinamically...
      >
      > this is my function:
      >
      > function createSVGLayer( id )
      > {
      > if( id == null ) return ;
      >
      > var input = document.createElement("input");
      > input.setAttribute("type","checkbox");
      >
      > // svglayers --> global variable
      > svglayers.appendChild(input);
      > svglayers.appendChild(document.createTextNode(id)) ;
      > svglayers.appendChild(document.createElement("br")) ;
      >
      > input.setAttribute("checked",true) ;
      > input.setAttribute("onclick","hiliteElement(this,'" + id
      + "')") ;
      > }
      >
      >
      > Thanks in advance
      > Best regards
      > [i980365]
      >
      >
      >
      >
      > Yahoo! Groups Sponsor
      > ADVERTISEMENT
      >
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > javascript_official-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      Service.
      >
      >
      > [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.