i bought a new hdd but when i try to install windows 8.1 or 7 it load the files and then the screen goes black and nothing happens anymore
What exactly did you do when you tried to install Windows on the new HDD? Did you use a USB/DVD or some OEM installation media?
I'm going to assume that:
a) You have an original Dell hard disk with Windows 8.1 or 7 on it.
b) You have replaced the original HDD with a new one.
c) You're trying to (re) install Windows on the new HDD.
If this is correct, then the problem is that Dell won't let you install Windows on another harddrive. Windows can only be installed on the original HDD.
It is my understanding that the only manufacturer-approved solution is some sort of cloning/migration software. I have never done this myself, so I can't offer any help on that. You might consider lodging a post on the 'Windows 10' section of Tom's and specifically ask about cloning an OS.