Always use quotes for attribute values
HTML does not require you to use quotes, but I recommend that you always use to avoid this kind of problem.
Cause of the problem:
When you do not use quotation marks, the result of your code is:
Assuming "good morning" as variable value $rodapé
onmousemove=window.parent.document.getElementById('calendario_obs').innerText='bom dia>$cont</text>
The browsers will put the quotes getting:
onmousemove="window.parent.document.getElementById('calendario_obs').innerText='bom">$cont</text>
cutting the dia'
and ignoring him;
or
onmousemove="window.parent.document.getElementById('calendario_obs').innerText='bom" dia>$cont</text>
cutting the dia
, by removing the simple quotes from the end and placing it as a new attribute in the tag with no value.
How does JS disregard these simple "orphan" quotes (as in 'bom
), he tries to search bom
as being a variable, soon will give that the variable is undefined (you can check in the console, possibly will be there).
How to correct:
Just add the quotes around the entire JS code.
Your code should be then:
onmousemove = "window.parent.document.getElementById('calendario_obs').innerText='$rodape'">$cont</text>
When I can not use quotes?
When your attribute contains NO space, because the separation of attributes in the tag is done by it.
Can you review the value being assigned to
innerText
? It looks like a tag strange</text>
that doesn’t make much sense.– Woss
Hi, it’s inside a text tag, it needs to be, the full statement looks like this: $texto_dia="<text class="font_botao_carmesim" onclick=window.parent.Document.getElementById('frame_calendario_variable'). src='calendario_variables.php? dia=$cont'; onmousemove=window.parent.Document.getElementById('calendario_obs'). innerText='$rodape'>$cont</text>"; only the end of the problem, if the footer variable has space does not appear, if it does not work perfectly.
– Luis Miguel
From what it seems you are only forgetting the quotation marks in onmousemove, in html the quotation marks are only not mandatory if there is no space, so your code would go up to "good", creating an incomplete string
'bom
and ignore the rest, giving variablebom
undefined– Pliavi