The plan is part of the Scottish Government's 2020 Vision for Health and Social Care, which aims to use technology to make improvements to services.
Health Secretary Alex Neil said online records would be kept securely by NHS Scotland, and access to them would be controlled and monitored to protect patient confidentiality. He also announced a further £10 million to support so-called telehealth and telecare projects, which use technology to allow people to better manage their health at home.
Patients use devices such as tablet computers, smartphones and other digital equipment to monitor conditions such as diabetes, heart problems and lung issues in their own homes.
Mr Neil said the NHS in Scotland was already leading the way in using technology to improve healthcare services, but Labour warned financial and workforce pressures would make "radical change" more difficult.
Mr Neil said: "These projects demonstrate our commitment to build the digital future we want to see in our NHS."
He added: "This future goal for patients to be able to access their health records online is one of the best and newest ways patients can keep track of their own care, including test results and prescriptions."
Labour's Richard Simpson said he supported the Government's goals, but highlighted existing IT problems within the NHS, including lack of integration, interruptions to services and poor recording of inappropriate accessing of data. He also said delivery of technological solutions had been dependent on individual health boards signing up.
He said: "The first step in delivering the 2020 vision will be to identify the pressures on the system... workforce issues, the challenge of the waiting times targets which many are finding difficult to meet, the delayed discharge target which has not been met in 16 of the last 20 quarters, and the shifting of the balance of care."
Liberal Democrat health spokesman Jim Hume said the potential from hi-tech systems was "mind-boggling", but stressed these must be used in a uniform way across the country. He said this was necessary because "many patients have to move from health board area to health board area".
The MSP also urged the Scottish Government to introduce a target for health boards to make use of this type of technology in the mainstream.
Tory Nanette Milne backed the use of technology, but stressed it was vital "not to lose sight of the growing pressures on the NHS".
She highlighted problems with delayed discharges, pressure on hospital beds and patients having to wait an "unreasonable" length of time to see their GP.