我想阅读VBA中的HTML代码(类似于Java中的URL).我需要将它保存在一个字符串中.我事后解析它.
alpan67
为什么这不起作用?在Firebug中,当我点击按钮时,它总是告诉我cambiaBandiera没有定义...
救命
亚历克斯
#ITA{
float:right;
margin : 5px 85px;
width:40px;
height:40px;
background : #FFFFFF url("../ITA_off.png") center center no-repeat;
border:0;
}
Run Code Online (Sandbox Code Playgroud)
<style type="text/javascript">
function cambiaBandiera() {
test=document.getElementById("ITA");
test.style.backgroundImage="url('../ITA_on.png')";
}
</style>
Run Code Online (Sandbox Code Playgroud)
<div id="bandiere">
<input type="button" id="ITA" onClick="cambiaBandiera()"> </input>
</div>
Run Code Online (Sandbox Code Playgroud) 我已经看到一个较旧的问题,答案是下面的代码,但如果我使用netbeans,我已经设计了我的comboBox.所以我认为(我想象的是Java和netbeans中的新东西!)代码的最后一行应该改变,我在哪里插入这段代码?
BufferedReader input = new BufferedReader(new FileReader(filePath));
List<String> strings = new ArrayList<String>();
try {
String line = null;
while (( line = input.readLine()) != null){
strings.add(line);
}
}
catch (FileNotFoundException e) {
System.err.println("Error, file " + filePath + " didn't exist.");
}
finally {
input.close();
}
String[] lineArray = strings.toArray(new String[]{});
JComboBox comboBox = new JComboBox(lineArray);
Run Code Online (Sandbox Code Playgroud) 我创建了一个抽象类,如下所示:
abstract class Chance
{
public void setTeams(SportEvent aSportEvent)
{
firstTeam = aSportEvent.getFirstTeam();
secondTeam = aSportEvent.getSecondTeam();
}
private int totalPlayedGames()
{
int playedAtHome = firstTeam.getHomePlayedGames();
int playedAway = secondTeam.getAwayPlayedGames();
int playedGames = playedAtHome + playedAway;
return playedGames;
}
private int totalScoredGoals()
{
int homeScoredGoals = firstTeam.getHomeScoredGoals();
int awayScoredGoals = secondTeam.getAwayScoredGoals();
int scoredGoals = homeScoredGoals + awayScoredGoals;
return scoredGoals;
}
abstract double getChance()
Team firstTeam;
Team secondTeam;
}
Run Code Online (Sandbox Code Playgroud)
然后,当然,我有几个类的方法getChance()...
现在,我想创建一个类,在其中我可以获得getChance()这些新类的结果.我想用的东西是这样的:
Class aClass = Class.forName(chanceClass....);
Object obj = …Run Code Online (Sandbox Code Playgroud)