LEESBURG, Virginia (AFP) - US presidential hopeful Barack Obama played up his foreign policy credentials while John McCain highlighted national security, as a poll Thursday showed the Democrat hanging onto his lead in three key states. Less than two weeks before the November 4 election, Obama made gains in Ohio while his Republican rival chipped away only slightly at the Democrat's edge in Florida and Pennsylvania, the survey by Quinnipiac University found. As each candidate strove to highlight his opponent's weakness, the survey indicated swing state voters favour Obama on the economy by margins of eight to 19 points, and McCain on foreign policy by margins of two to six points. Obama, flanked by top veteran military officials in Virginia on Wednesday, portrayed McCain as "out of touch and running out of time," after rejecting new Republican jibes on his plans for taxes and national security. But McCain warned the Democratic Illinois senator not to take victory for granted, despite his mammoth financial edge and solid lead in a slew of opinion polls. Obama is scheduled to take time out from the campaign trail Thursday in order to visit his ailing grandmother in Hawaii. McCain also returned to his attack on recent comments by Democratic vice presidential pick Joe Biden that, just like former president John F. Kennedy, Obama would be "tested" by a crisis on the international stage within six months of taking office. The military veteran noted he had some "personal experience" with crises, citing his role in the United States' 1962 showdown with the Soviet Union over its missiles in Cuba " known as the Cuban Missile Crisis. At that time, the Republican nominee was as a fighter pilot assigned Cuban targets. "I know how close we came to a nuclear war and I will not be a president who needs to be tested. I have been tested," he told an enthusiastic rally on a high school football field in Green, Ohio. McCain's running mate, Alaska Governor Sarah Palin, also took another run at Obama, ramming home the Republican claim that the Democrat would hike tax rates across the board in a "socialized" wealth sharing scheme. "He's hiding his real agenda of redistributing your hard-earned money," she told the rally. "It doesn't sound like many of you are going to be supporting Barack the Wealth Spreader in this election." But Obama said such attacks were distortions, and symptomatic of a McCain-Palin effort that acknowledged they were running down the clock to the election. Obama lampooned McCain's idealized picture of "Joe the Plumber" " an Ohio tradesman who had challenged him on his tax plans. McCain sought to portray Obama as taking the electorate for granted, given a clutch of favorable polls and the massive 150-million-dollar warchest he amassed in September. Meanwhile, White House hopeful Barack Obama said in an interview Thursday he decided to travel to the bedside of his ailing grandmother because he wanted to avoid making the same mistake he made by not rushing to his late mother's side before she died. When Obama's Kansas-born mother, Ann Dunham, passed away, I "got there too late," he told CBS television. "We knew that she wasn't doing well but, you know, the diagnosis was such where we thought we had a little more time and we didn't. And so I want to make sure that I don't " I don't make the same mistake twice," Obama said.