Javascript How-ToAsk your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I've never been asked this before so hence the posting but I've got a combination of asp vbscript and javascript working to perform a check on a value - if that value exceeds x amount then the prompt appears informing the user that they have added too much.
This is essentially it:
<%
if desiredValue >= 100 then
%>
<script language="javascript">
window.alert("Your total value must not exceed 100.00");
history.back();
</script>
<%
end if
%>
During the time the javascript alert appears the page background turns white - is there a way to make the background colour of the page different during the time the alert is on the screen?
Your code seems to fire as soon as that part of the HTML is loaded which means the browser may not have enough HTML loaded to display the correct page. You could defer executing that JavaScript until the DOM has finished loading, using jQuery for example.