Write down the url of the malware site, all you need is the domain name like discussions.apple.com, nothing else is needed.
1: Command tab to the Finder
2: Apple Menu > Force Quit > Safari
3: Relaunch Safari holding the Shift key down to disable reopening of previous pages.
4: Reset Safari.
5: Report the offending site to: https://www.google.com/safebrowsing/report_badware/
6: Restart your machine and restore from TimeMachine backup or bootable clone (optional at this time as we don't know much about it on Mac's yet)
7: Harden your Mac against stuff like this: Harden your Mac against malware attacks
If u unable to close safari or shutdown,go to apple top screen force quit apps wil tell u unresponsing apps click on it and hold power button down at least 30 sec this force shutdown if u cant close normally and u are able to power on after this then get rid of java and java script,u dnt need its ,u can control this go to safari top screen,perferences then security and make sure no ticks in boxes both java and java script,its rubbish....good luck