in your onclick, the argument passed to the mymethod function needs to
be in quotation otherwise it is interpreted as a variable.

On Feb 9, 11:45 am, "[email protected]"
<[email protected]> wrote:
> hi,
>
> I am using DashCode,
> my program that I am building currently showing a list of Counties in
> the UK.
> When I click on a County, ie; Aberdeenshire - I would then expect to
> show a list of pubs in that County (coming from my PHP page in same
> way I am showing Counties)
>
> What is actually happening... it shows a list of counties but when you
> click select a county, DashCode errors and says:
>
> Can't find variable: Aberdeenshire
>
> and It stops the simulator, I want it to go onto View4 of the
> StackLayout
>
> here is my relevant code:
>
> top of HTML page:
> [code]
> $.getJSON('http://www.mypubspace.com/dashtest/countyjson.php',
> function(data){
>     var myhtml = '<ul>';
>    for(i=0; i<data.length; i++) {
>       myhtml += '<li onclick=\"mymethod('+data[i].County+');\">' +
> data[i].County + '</li>';
>    }
>    myhtml += '</ul>';
>    $("#countyshow").html(myhtml);
>
> });
>
> [/code]
>
> mymethod function
> [code]
> function mymethod(County) {
>     var County = document.getElementById('County').object;
>     var stackLayout = document.getElementById('stackLayout').object;
>     stackLayout.setCurrentView('view4');}
>
> [/code]

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to