facebook

Changing images through Javascript code: CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #331626 Reply

    mansilvcas
    Member

    Hi! I am very new to Mobione, therefore I apologize for the simple question I have…

    I want to insert an image button, and when on-click of this image button run a javascript code which would allow to change the image. I have tried with point number 14 in http://www.genuitec.com/mobile/docs/javaScriptSnippets/javaScriptSnippets.html but there is something that I am missing that does not work when I input the code in the run javascript code in mobione design screen.

    I am trying with the following code

    <img id=”image1″ src=”images/Koala.jpg”/>
    $(‘#m1-images-image1’).attr(‘src’, images/Tulips.jpg);

    These images are in the folder Mobione/Test-www/images

    Can you help me? Thanks a lot !!!

    #331628

    Hi mansilvcas,

    Seems you miss the quotation marks:

    $(‘#m1-images-image1’).attr(‘src’, images/Tulips.jpg);

    or

    $(‘#m1-images-image1’).attr(‘src’, images/Tulips.jpg);

    #331629

    mansilvcas
    Member

    Many thanks, Octavio. Still, I run the test center and don’t get the change in image when clicking the original image… it must be something really simple, but I just don’t get it. What can it be? Thanks for your help !!!

    #331632

    mansilvcas
    Member

    Hi, to help you address my question I have created a very short word document with all the steps that I am taking, but I cannot attach it to this message, how could I show it to you? There is some place that I am doing things wrong and I am stuck with this, if you don’t take a look at all the steps I am taking perhaps you will not be able to assist… Thanks a lot !!!

    #331640

    Hi mansilvcas,

    Please try downloading this example and see if you find the differences that are making your code invalid: http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=2044

    In case you continues with the problem, send us your document and design files (include <project>_www folder) via support at genuitec dot com. Use title: Mobione data from mansilvcas

    #331655

    @mansilvcas,

    I’ve followed up with you by e-mail, let me know if the problem continues or if I can closed this thread.

    #331659

    mansilvcas
    Member

    Thanks a lot, now it works perfect!! Just one more question: is it better to use image buttons instead of simple images? what is the difference in terms of functionality?

    Thanks again !!!

    #331725

    @mansilvcas,

    It depends on what you want to accomplish. One of the main differences is that image-button can have an active image when clicked/touched.

    #331726

    mansilvcas
    Member

    OK, many thanks for everything, you have been very helpful !!!

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Changing images through Javascript code: CLOSED

You must be logged in to post in the forum log in