Friday, June 8
Javascript gotcha
I recently ran into an issue with JavaScript where the script tag was ended with
Please overlook the missing "<" at the start of the script tags, since blogger understandingly has issues with script tags.
In spite of the rendered page containing the above script blocks, the showCalender function was not found and I kept getting a runtime javascript error: Object not found.
IE provided no clues about what is happening, finally when I looked at the source in Firefox with the color scheme, it dawned upon me that only the first script tag is being recognized while the rest are being ignored.
When I changed them to:
So the moral is, close the JavaScript tags with /script> even though the /> might work in certain cases, it baffles you in cases like this.
Please overlook the missing "<" at the start of the script tags, since blogger understandingly has issues with script tags.
script src="../jscalender-1.0/calender.js" />
script src="../jscalender-1.0/calender/look.js" />
script src="../jscalender-1.0/calender/feel.js" />
script language="javascript" type="text/javascript">
function showCalender()
{
}
/script>
In spite of the rendered page containing the above script blocks, the showCalender function was not found and I kept getting a runtime javascript error: Object not found.
IE provided no clues about what is happening, finally when I looked at the source in Firefox with the color scheme, it dawned upon me that only the first script tag is being recognized while the rest are being ignored.
When I changed them to:
script src="../jscalender-1.0/calender.js"> /script>
script src="../jscalender-1.0/calender/look.js" > /script>
script src="../jscalender-1.0/calender/feel.js" > /script>
script language="javascript" type="text/javascript">
function showCalender()
{
}
/script>
So the moral is, close the JavaScript tags with /script> even though the /> might work in certain cases, it baffles you in cases like this.
Subscribe to Posts [Atom]