Problems with generated Links (Javascript)


hallo,

 

i started developing adobe air , facing strange problem. use prototype , scriptaculous javascript framework. application communicates server via air.urlrequest , air.urlloader. depending on result of requests <a>-elements must created call javascript-functions. generated anchors dont work. there 2 anchor-elements created before first request work fine.


the other generated ones displayed , correctly appended dom, not work (they make window jump top, href="#" does).

 

example:

<a onclick="showdetails(188); return false;" href="#">test123</a>           //generated after request, not work
<a onclick="startsearch(); return false;" href="#"><img ...></img></a>  //generated before request, works

 

note: same javascript used create , append links in both cases.

 

thank in advance,

rieps

hey again,

i'm sorry if pushing thread not allowed.

 

i still couldn't figure out way things working. created little example illustrate problem:

 

<html>
     <head>
        <title>example non working links</title>
        <link href="sample.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="lib/air/airaliases.js"></script>
        <script type="text/javascript" src="lib/air/airintrospector.js"></script>
        <script type="text/javascript" src="lib/air/airlocalizer.js"></script>
        <script type="text/javascript" src="lib/air/airsourceviewer.js"></script>
          <script type="text/javascript" src="lib/prototype/prototype.js"></script>
        <script type="text/javascript">
               function createlink() {
                    var link = "<a href='#' onclick='saysomething()'>new link</a>";
                    $("myid").insert(link);
               }
               function saysomething() {
                    alert("hallo");
               }            
        </script>
     </head>
    <body>
         <div id="myid">
         <script type="text/javascript">
              createlink();
         </script>
        <button onclick="createlink()">create new link</button>
         </div>
     </body>
</html>

 

the first link called new link works, others created clicking on button dont.

i guess has security restrictions, have idea workaround? appreciate that.

 

greetings,

rieps



More discussions in Archived Spaces


adobe

Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい