Tecvid,
<!DOCTYPE html>
<html>
<head>
<meta charset="windows-1251">
<title>foo</title>
<style>
</style>
</head>
<body>
<p id="foo" mmm="nnn">foo</p>
<p id="bar" mmm="nnn">bar</p>
<script>
sel=document.querySelector.bind(document)
function attr(selector, attribute, value) {
if (!value) return sel(selector).getAttribute(attribute)
sel(selector).setAttribute(attribute, value);
}
console.log(attr("#foo", "mmm"))
console.log(attr("#bar", "mmm"))
attr("#foo", "mmm", "111" )
console.log(attr("#foo", "mmm"))
</script>
</body>
</html>