Simple javascript not working

Hello,
I have got a problem with this simple javascript that works
on every browser I tested but not on AIR (1.5.0 on Aptana Studio) :
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function init()
display();
var nb=10;
function del()
nb--;
display();
function display()
var i;
var res = "";
for (i=0; i<nb; i++)
res += "<li><a onclick=\"del();\">link"+ i
+"</a></li>";
document.getElementById("results").innerHTML = "<ul>"+
res +"</ul>";
</script>
</head>
<body onload="init()">
<p onclick="del()">test</p>
<div id="results"></div>
</body>
</html>
Clicking on any link in the list should reload this list with
one item less, but it only works once, I do not understand why
considering this code perfectly works on any browser.
Clicking on the "test" text in the <p> also works
perfectly and I have got no error message in the console, so what
is the problem, please?
Thanks for your help.

Unsure what the problem is. I copied almost verbatim and it
worked fine for me.
here's my script (slightly different due to my base file is
xhtml strict)
quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<title>Adobe Air 1.5 Test</title>
<script src="lib/AIRAliases.js"
type="text/javascript"></script>
<script src="lib/main.js"
type="text/javascript"></script>
<script type="text/javascript">
function init(){
display();
var nb=10;
function del(){
nb--;
display();
function display(){
var i;
var res = "";
for (i=0; i<nb; i++)
res += "<li><a onclick=\"del();\">link"+ i
+"</a></li>";
document.getElementById("results").innerHTML = "<ul>"+
res +"</ul>";
</script>
</head>
<body onload="init();">
<p onclick="del()">test</p>
<div id="results"></div>
</body>
</html>

Similar Messages

  • Help! Javascript not working when object moved from one page to another!

    Hello all:
    I am new to Adobe Livecycle Designer (version 8.0). I have created a 3 page interactive pdf form with numerous objects (text fields, radio buttons, drop-down boxes, etc.), that our business wants to begin using soon.
    I am having difficulty with some of my Javascript not working with a few of my objects on page 2 of the form. Specifically, there is a drop-down box for "Country" on page 2 of my form. When the user selects, for example, "United States" from the list, I have Javascript that is supposed to change the "Currency" drop-down box rawValue to "US Dollars" accordingly (upon the change event).
    I think my Javascript syntax is proper, but I am not certain. Here is my simple Javascript associated with the "Country" drop-down box (Note: rawValue 80 = "United States" and rawValue 105 = "US Dollars"):
    form1.Page1.cmbContactInfoCountry::change: - (JavaScript, client) -
    if (this.rawValue == 80) {     
         cmbCurrency.rawValue = 105;
    This seems pretty straight forward and it WORKS when my "Country" drop-down box is moved to page 1 of the form, but it WILL NOT WORK when I move the "Country" drop-down box back to page 2 of the form (which is where it belongs).
    Does anyone have any suggestions or solutions? I have spent probably 6-8 hours racking my brain trying to figure out why it works when on one page, but it does not work when move to a different page. I am guessing that I may have corrupted something OR that I am not fully addressing the proper name of the object?
    Please help!
    Frustrated and helpless near Chicago!
    Taylor T

    Hi Jono:
    Thank you for your quick reply.I was able to obtain the full name of the cmbCurrency object using the method you taught me. That is brilliant! Great short-cut tool.
    Unfortunately, I am still having issues with getting Javasript for the cmbCountry object to work with the cmbCurrency object. I haved pasted my new Javascript below.
    JavaScript for cmbCountry object:
    //UNITED STATES
    if (this.rawValue == 1) {
              xfa.resolveNode("form1.#subform[1].cmbCurrency").rawValue = 1;
    else
    //CANADA
    if (this.rawValue == 2) {
              xfa.resolveNode("form1.#subform[1].cmbCurrency").rawValue = 2;
    I have checked the "Specify Item Values" checkbox of the cmbCurrency drop-down object and Value 1 = "US Dollars" and Value 2 = "Canadian Dollars".
    When I select "Canada" from the cmbCountry drop-down object, the rawValue of the cmbCurrency drop-down object is changed to "US Dollars" (when it is clearly defined as "Canadian Dollars"). When I select "United States" from the cmbCountry drop-down object, the rawValue of the cmbCurrency drop-down object stays blank for uknown reasons. Very strange.
    Since I am not able to further explain in detail on what I am experiencing, I have posted a link to my file below (I just signed up for an account at ShareFile). I would forever be indebted to you if you can help me figure this out!
    https://thomptk.sharefile.com/?cmd=d&id=07ede2fe11db4549

  • Obfuscated JavaScript not works in safari 5.0.2

    Hi All,
    I'm very new to safari browser and currently makes my web application in safari. It works fine with few bugs in UN-obfuscated JavaScript.
    Obfuscated JavaScript not works in Safari. Kindly let me know the solution or set up. This is quite urgent and seeks for earlier response.
    Thanks in advance.

    For OS X javascript issues, post to the Unix or Developer forums under OS X Technologies. For windoze issues, I have no suggestions, since I don't do that technology.

  • Javascript not working in any browser except Opera! Please help!

    I don't know for what particular reason, javascript has stoppped working in all the browsers I have, (Safari, Firefox, Camino, OmniWeb,)except on Opera. Can anyone direct me in the right direction to solve this issue?

    Ok...
    1.) Unless it is a horribly designed site javascript not working would not prevent you from at least opening said site. You might not be able to use some of the features, or in the example of acual applications like gmail or then new yahoo mail you might not be able to use those at all since they are written soley for js. But for sites like VersionTracker it shouldnt make a difference.
    2.) Javascript is an interpeted language run on the client - ie the web browser. There is nothing to install. its part of the web browser youre using. You can uninstall and reinstall the browser itself but javascript is not a seperate component or something that is shared across applications that utilize it.
    Javascript is not the issue here at least in the case of versiontracker and 1010wins. I turned JAvascript off in my browser and visited both and they load jsut fine. Your eChalk mail might need js but i dont know about all that.
    So.... what happens when you try to visit one of these sites in one of the problem browsers???? Do you get a balck white screen? A server Error message? a DNS error? Does the app crash? etc..

  • Simple pass not working windows 10

    simple pass not working, does not recognise windows password at start to gain access to system, no flashing light, driversin software only go to windows 8.1.How do I reset the lot or reinstall simple pass?

    I have an HP Elitebook 8760W.  I cannot get Simplepass or Windows Hello to recognize my Validity VFM-471 fingerprint reader.  I'm not sure I have the right driver installed for the Validity hardware.  Could someone please point me to a link for the proper Win 8.1 driver?   I'm trying to make this work on Windows Pro 64 Bit.   I have tried everything to make this work.  Both Simplepass and Window Hello recognize the fingerprint read while I'm setting it up, but when rebooting and trying to log in with the fingerprint function - it doesn't act like it is even working.  I've tried all of the suggestions on the instructions to no avail.  The Laptop works just fine without the fingerprint scanner, and I guess I can live without it, but I've been used to using it on Windows 7 for so long, I'd like to have it working agian.  Any suggestions or hellp would be greatly appreciated.  Thanks in advance. 

  • Javascript not working in Firefox on Mac OS 10.9.2

    I am trying to learn Javascript from a tutorial. I'm using Text edit to create a simple .html file that calls a .js file using the script command. The .html file opens normally in the default browser and can print a message to a simple page. It looks like a window tries to open the .js file but it vanishes before opening. I have checked that Javascript is enabled in Firefox. Opening Firefox in Safe mode does not fix the problem. It also fails to execute the .js file in Safari and Chrome.
    This problem happens on three Macs, all running Mavericks 10.9.2. When I try this on a Windows PC the .js file executes as expected.
    I've tried everything I can think of including turning off the Firewall in Security Settings. It seems like it has to be something system-wide since it happens in all three browsers. Has Apple implemented some type of blocking of Javascript in Mavericks? Any suggestions for why this is not working on my Macs and what I can do to fix it would be greatly appreciated!

    Cor-el: Thank you for noticing that! Turning off smart quotes in Textedit which I am using to create the scripts solved the problem. Everything working as expected now. I hope others using Mac OS 10.9.2 will benefit from this as well.

  • External Javascript not working with C# and XAML windows phone app

    I've added a WebView into my project. If I navigate to the html file that contains external javascript files they don't work. Bit if I write the javascript code hardcoded into the html file it works properly.
    Here is the html portion:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="testjs.js"></script>
    </head>
    <body>
    <div id="abcd"></div>
    <br/>
    hello! this is a simple html block.
    </body>
    </html>
    Here is the javascript portion:
    document.getElementById("abcd").innerHTML = "New text!";
    When I open the webview it shows
    hello!
    this is a simple html block.,
    but if the javascript code worked it would show
    New
    Test! hello! this is a simple html block.
    And in the C# code the uri is called this way:
    url = onlineTestWebView.BuildLocalStreamUri("myUrl", "problem_page/test.html");
    StreamUriWinRTResolver myResolver = new StreamUriWinRTResolver();
    onlineTestWebView.NavigateToLocalStreamUri(url, myResolver);

    I assume this is because you are using NavigateToString. Please see
    http://blogs.msdn.com/b/wsdevsol/archive/2014/06/20/a-primer-on-webview-navigatetolocalstreamuri.aspx
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Simple calculations not working in acrobat 9

    I have text form fields made in Acrobat 9 from a previously made pdf, where I need a simple calculation, but I cannot get it to work.
    The form is not for submission, only for personal tracking, so I don't even need validation.
    FieldA (a number they enter) x a number I have entered in the calculation = FieldB
    FieldB x FieldC (a number they enter) = FieldD In FieldB I have a simple javascript Calculation in the form field: FieldA * .115, which should automatically calculate answer into FieldB, when tabbed.
    In FieldD I have a Calculation in the form field: FieldB * FieldC, which should automatically calculate answer into FieldD. All fields are set as numbers.
    I have left the Trigger Action as Mouse Up.
    I don't need to validate, as this is personal use, and is not being submitted.
    I have all fields in the correct tab order.
    I have reader enabled the form. When I open the form in Reader, I can enter the numbers, but no calculations are being performed. It reads 0 in FieldB and FieldD. Any assistance would be greatly appreciated.

    Hello Everyone,
    I use the following VBS code, but to tell the truth, I don't know if it works or not. The main idea was to enable commenting from Adobe Reader. But after execution code, saving document and reopening it in Reader, commenting is still 'Not Allowed'. Is showAnnotToolsWhenNoCollab really capable to allow this and there is only error in my code? Or is the functionality different and this way can never be used for what I want?
    There is another issue that application is not closed on Exit, but is still shown.
    scriptPath = "C:\Acrobat\"
    Set gApp = CreateObject("AcroExch.App")  
    Set pdDoc = CreateObject("AcroExch.PDDoc")
    sampleFilePath = scriptPath & "AR_test_orig.pdf"
    pdDoc.Open sampleFilePath
    pdDoc.OpenAVDoc "myFile"
    gApp.Show
    Set formApp = CreateObject("AFormAut.App")
    'formApp.Fields.ExecuteThisJavascript "app.alert(""hello"");"
    formApp.Fields.ExecuteThisJavascript "Collab.showAnnotToolsWhenNoCollab = true;"
    Set formApp = Nothing
    pdDoc.Save 1, scriptPath & "AR_test.pdf"
    'pdDoc.Close
    gApp.CloseAllDocs
    gApp.Exit
    Set pdDoc = Nothing
    Set gApp = Nothing
    Thanks for any ideas.
    Jan
    PS: I use Acrobat 9.0 Pro

  • Javascript not working in htmldb

    Hi,
    I am using HTMLDB Release 2.
    The time I put some java script in page html header section and click on apply changes, it redirects me to wwv_flow.accept page can't be displayed.
    Please let me know how to correct this as I want to use javascript in my page.
    even the most simple script is not working
    ==============================
    <script type="text/javascript">
              <!--
    alert('hello');
    // -->
              </script>
    ==============================

    JavaScript is an event driven language; simply putting code on the page does not mean that it will be executed. You will need to have something call your code for it to run.
    In order to do that, you will need to use the proper syntax for a JavaScript function. Your code should read:
    <script type="text/javascript">
    <!--
    function jsDemo()
    alert('hello');
    // -->
    </script>Now, you can call the JavaScript function jsDemo() from a button, for example. Simply create a button, and set it to redirect to a URL. For thre URL, enter this:
    onclick="jsDemo()";There are many more ways to incorporate JavaScript into your applications - have a look on the APEX home page or this forum for some more examples.
    Thanks,
    - Scott -

  • Javascript not working in finalizer method of bounded taskflow

    i hava a javascript code in bounded task flow which is calle din the finalizer method of task flow.
    But the javascript is not executing at all
    Even a simple alert is not working
    Code--
    public void refreshTaskFlow(){
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service =
    Service.getRenderKitService(ctx, ExtendedRenderKitService.class);
    service.addScript(ctx,"alert('hello world');");
    service.addScript(ctx, "function nextTask() {this.parent.submitButton(\"" + refreshTaskListButtonId + "\");} nextTask();");
    }

    The fields available in the Structure "MEREQ_ITEM_S_CUST_ALLOWED" (PReq Fields That Can Be Modified via User Exit) will be available for change in the method SET_DATA. 
    See the Method IF_PURCHASE_REQUISITION_ITEM~SET_DATA in include program LMEREQF10 (Line number 62).  You may have to APPEND the custom field in the strcuture mentioned above.
    Also ensure that the method SET_DATAX is also called after method SET_DATA in the BADI.

  • Copied page has resulted in javascript not working

    I have a page 6 that works great with its javascript functions in the HTML Header.
    I wanted to try some different things on the page without messing up the master, so I copied page 6 to page 2006. The page definition's HTML Header code for page 2006 looks just like the page 6 page definition's HTML Header code.
    However, when I run page 2006, my javascript functions do not work. NOTE: The javascript functions are simple and mainly show and hide functions for fields.
    I used the copy wizard in Apex 3.0.
    Does anyone have an idea what might have happened? Or is there a better way to copy a page?
    Thanks in advance.
    Maggie

    Rutger,
    You were right. Inside my javascript functions I had forgotten to change the code to reflect the items on page 2006 (i.e. P2006_NAP_ID instead of P6_NAP_ID).
    So now everything is good there. Thank you.
    I have another question though.....why would my new page's CREATE button not work properly after the page copy? I checked and compared the P2006 CREATE button and its Branch that returns to same page with the P6 CREATE button and its Branch. And it looks like it is correct. However, when I click the P2006 CREATE button, the data is submitted to database and an id is made for the new record; but, when the page refreshes after the submit, all of the fields are blank. There are no values displayed. It is in a state of being ready for a new record to be created.
    What have I lost? Can you tell me what I should check out?
    Thanks,
    Maggie

  • Simple Pass not working with Windows 7 Premium

    I have a Pavillion Notebook, model dv6-6b51sa running Windows 7 Home Premium 64bit O/S
    For some time now my Simple Pass has not worked. I have uninstalled and reinstalled the programme but to no avail. I have read several posts to the community here and have tried just about all recommendations including; hard reset, system restore (in case it had anything to do with Windows updates) a BIOS update and shutting down and rebooting after each process.
    Now, having reinstalled Simple Pass (from the HP Support website) , biometric devices do not even feature in Device Manager!
    Can anyone kindly offer me assistance?

    Hi @tagl
    Welcome to HP Forums! I will be happy to help with the SimplePass problem you are experiencing. The fact you are missing a biometric device in your Device Manager would be a problem because for it to work you need the software and the accompanying biometric device. Here is the Validity Fingerprint Sensor Driver, install that and then see if you are able to use your fingerprint reader.
    Please click “Accept as Solution ” if you feel my post solved your issue.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Thank you,
    BHK6
    I work on behalf of HP

  • Capturing form values with javascript (not working in Safari!)

    Hi
    I'm working on a site and I need to be able to take the values of one form (that the user has entered) and use them to populate a second form (more details) in the appropriate input boxes. This works on all browser except Safari. It seems to me a javascript problem (as getElementById does not work properly) but I'm not entirely sure. The code I use to grab the form elements is as follows:
    obj = $('formslider".$this->id."');
    obj.getElementById('registerfirstname".$this->id."').value = callbackfirstname".$this->id.";
    obj.getElementById('registersurname".$this->id."').value = callbacksurname".$this->id.";
    obj.getElementById('registeremail_addr".$this->id."').value = callbackemail".$this->id.";
    obj.getElementById('registertelephone".$this->id."').value = callbacktelephone".$this->id.";
    obj.getElementById('registerrequest_type".$this->id."').value = requesttype_callback".$this->id.";
    This basically takes the values of the "callback" form and places them into the appropriate input boxes of the "register" form. However it seems to lose the values when moving to the next form. Please note, I am not refreshing - I am using Ajax to change the form so new content simply replaces an existing content, not transfering to another page. I use Sessions so it shouldn't forget the values.
    Can anyone help? It's quite an important thing as I need to migrate hidden form inputs too which are needed for this particular request system.
    Thanks
    Michael

    I'm seeing this same issue in Mavericks, 10.9.2.  Althought JavaScript is enabled in Safari, it just doesn't work, for any pages.
    I've tried different user accounts, including a new account, on the same machine, but they all do the same thing, so it's a machine-wide issue.
    I have plenty of other Mavericks machines, including my own, where it is working just fine, however, with the same settings.

  • Attach JavaScript not working in Acrobat Reader XI

    Hello,
    I created a fillable PDF in which I used the following JavaScript for an "Attach" button: 
    this.importDataObject("MyFile");
    This JavaScript worked and allowed the end user to attach files to the PDF in previous versions of Acrobat (through version 10 / Pro), but the button's functionality does not work in Adobe Acrobat XI.  The button has no functionality when clicked, and no errors are received indicating what the issue may be.
    Is there a bug that exists making this file not compatible with the Acrobat XI version, or is my coding outdated/inaccurate?
    Please advise and thank you for your help!
    Jessi Fenton

    Did you ever figure this out? I am also having problems with the "No Hand" javascript which turns off the (not very helpful) page-forward hand icon (a hand symbol with a down arrow) which confuses our users when in fullscreen mode. We create interactive PDFs and everything worked fine up to Acrobat X/Reader X. Now in XI it doesn't allow the internal link icon (pointing finger) nor weblink icon (pointing finger with W) to appear. It just remains a plain o’ hand icon no matter what you mouse over even though there are links present.

  • Help - Simple mask not working in Flash CS4

    Hi everyone,
    Thanks for taking a minute to read my post.
    I am creating a very simple mask using motion tweening. I created some text on a layer and made it a masked layer. Then I created a mask layer which consists of a circle that will span across the text. When I play the movie the circle does not show up at all in the frames the mask layer spans (it's purple on a black background) and the circle does not move across the text like I told it to with the motion tweening. I don't know why it's not working. For some reason the circle isn't showing on the stage at all and it's not moving across the text. I don't know if I have it set up wrong on the timeline or what. Here's the steps I followed to create the mask:
    1.insert a new layer in which I named it mask and click frame 1 on this layer
    2. select the oval tools on the tools panel and set the stroke to none
    3. set the fill color to purple
    4. draw a circle and click the selection tool and drag a marquee around the circle to select it.
    5. click insert on the menu bar, click motion tween then click ok in dialog box about converting it to a symbol to be tweened
    6. click the last frame in the mask layer and drag the circle to the end of the line of text
    7.click mask on the timeline to select the mask layer, click modify on the menu bar, point to timeline then click layer properties
    8. verify the show check box is selected in the name section, click the lock check box to select it, click the mask option button in he type section, then click ok.
    9. play the movie in which the circle object covers the text on the masked layer as it moves across the stage
    Thanks for your help!
    ashmic19

    Update 8-2-10: In play mode the text was still visible when it shouldn't be but once I tested the movie the mask worked correctly with the text. So problem solved
    -ashmic19
    Thanks for all who viewed this. I finally figured out why it wasn't working. I had the mask layer locked. But now the circle is moving across the text but the text is viewable when it shouldn't be until the circle moves across it. How come it's doing this?
    ashmic19
    Message was edited by: ashmic19
    Message was edited by: ashmic19

Maybe you are looking for

  • Html outputlink  in datatble

    Hi, in JSF,in a datatable i am using <h:outputLink> for a column.. and i am using some events for security purpose.. For example <h:commandButton id="btn4grpnam" value="Group Name"      action="masterfaqsublist" event="faq.addgroup"      styleClass="

  • Indesign CC crashing / freezing on save new folder name folder dialogue box

    Hey guys, I am having a reacuring bug regarding the new and awesome indesign cc 9.2 64 bit windows pc. When I am saving or opening in indesign if I use the dialogue box to create a new folder to save the file in it creates it and then when the mouse

  • Creating a Non-RAC ASM 10gR2 instance in Solaris 10 (x86)

    DB Version:10gR2 OS: Solaris 5.10 for x86 (Installation DVD released on June 2006) I have decided to remove the windows installation in my old laptop.I am going to install only Solaris 10 (x86) in this to create an ASM instance. My laptop has a singl

  • Payment hasnt gone though?

    So basically I purchased an iPhone 6 online like a week ago, for £619. I got a confirmation and everything and an email to check order status. I checked my bank balance this week, and realised no money has been taken out. So Im really confused, when

  • Contact Person Replication Problem - Updating could not be completed

    Dear Experts, I'm facing the problem when replicating contact person from CRM to R/3. It only happen when changing the bp/contact person that paired (with contact person relation type) to more than 5 customer/bp and it always error when replicating t