Hi,

The code below retrieves an anchor tag name '25' from the '1.html' document when I type '25' in my NSTextField, and loads it in WebView. But the '1.html' document contains many numerical anchor tags. Does anybody know how I can retrieve any anchor tag I type in NSTextField and load it in WebView?

- (void)gotoAnchor:(NSString *)name {
        
NSString *path = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"html"];
        NSURL           *baseURL = [NSURL fileURLWithPath:path];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%...@#%@",[baseURL absoluteString], name]];
                                                                                
                
        NSURLRequest    *req = [NSURLRequest requestWithURL:url];
        
        [[webView mainFrame] loadRequest:req];
}

- (IBAction)gotoAnchorTag25:(id)sender
{
        [self gotoAnchor:@"25"];

}

/Philip

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to