js function

Discussion in 'iOS Programming' started by knut, Aug 1, 2009.

  1. knut macrumors newbie

    Joined:
    Jun 30, 2009
    #1
    Hi All
    I have a problem with calling js function.
    I have already loaded html and from my c code i try call js function but no result.
    when I write everything perfect
    Code:
    NSString * _script = @"document.getElementById('Text').innerHTML;";
    NSString * res = [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:_script]];
    but wen I try call function I get null result i.e
    NSString * _script = @"function test(){window.location = '/playSong/1';}";
    NSString* result = [webView stringByEvaluatingJavaScriptFromString:_script];
    who can help me?
    Thanks
     
  2. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley

Share This Page