2011-03-21 125 views

回答

3

試試這個代碼

final LabelField label = new LabelField("http://www.google.com",LabelField.FOCUSABLE){ 
      public boolean navigationClick (int status , int time){ 
       BrowserSession bSession = Browser.getDefaultSession(); 
       bSession.displayPage(label.getText()); 
       return true; 
      } 
     }; 
-3

你可以使用jQuery。 試試這個代碼:

<html> 
<head> 
<title>Opens a link</title> 
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.js"></script> 
</head> 
<body> 
<label for="link" id="target">www.google.com</label> 
<script type="text/javascript"> 
    $('#target').click(function() { 
     var url = $(this).text(); 
     window.location = "http\://"+url; 
    }); 
</script> 
</body> 
</html>