- This topic has 4 replies, 2 voices, and was last updated 14 years, 2 months ago by Albatros78.
-
AuthorPosts
-
Albatros78ParticipantHi,
I created a simple project with one push button. (mb1m9u4)
– My project is spelled test.mobi
– The html file of my project has reference to custom.js like:
<script type=”text/javascript” src=”test_custom.js”></script>– In the source file a new file appears which is test_custom.js.
– Into this file I have added my javascript function.
– in the link prperties of my button I have added: javascript:test_custom.myfunction()When I run into test center, into the debugger with my html file I have the error message:
24ReferenceError: Can’t find variable: test_customObviously my original code developped before on my PC (html & jav) works fine on my google or safari browsers on my Windows PC !
I tried just to use & migrate one of my function with mb1 for tests, but no success
Any help would be appreciate to understand how to call correctly java function from a personnal js file
Regards
wayneModeratorI suspect the problem is that your custom javascript might need some type of initialization. See the attached screenshot of a simple example where I added some custom javascript to my “alert-button” design. Can you share your custom javascript file with me to review what might be happening? If you don’t want it to be public then send the file(s) to support at genuitec dot com to my attention (Wayne).
See attachment custom-javascript.png
Wayne
Genuitec Mobile TeamAttachments:
You must be logged in to view attached files.
Albatros78ParticipantHi wayne,
My files are there. No problem to share them.
Like I said, my original files (html and js file) works fine on my browser and ALSO through safari into test center if I use the complete Local URL from Safari.
My tests were successfull in these mode
When I try to use same javascripts into mb1 project, the link does not works. !!!Thanks for your help… But I don’t undertsand why it works on Safari on test center, and not into mb1 project.
Javascript syntax is not the same ?Regards
Attachments:
You must be logged in to view attached files.
wayneModeratorhi albartos,
Your example works with a couple of minor edits. Here is what I changed:
1) changed text field Link property to javascript:initDB()
2) changed text field element look to
D_base = document.getElementById(“m1-Sample_DB-dbname”).value;3) changed exit() to return
See attachment local-db.png
See attachment for updates.
Wayne
Genuitec Mobile TeamAttachments:
You must be logged in to view attached files.
Albatros78ParticipantHy Wayne,
Thanks for your help.. very nice. Now everything is ok..
I will post my Db example when complete in few hours.
It would be very usefull to community and you also probabbly or you Tech Support
Hope this helps
Regards
-
AuthorPosts