Recently, I came across an interesting solution to a problem with a PHP application. It was discovered that placing the Java Script in the body section resolved the issue where CSS file attributes were being ignored when clicking the Alert box. In my code behind on the aspx.vb page load, I have a script for an Alert box that either appears or remains invisible based on the query parameter sent to the page - [?id=1] or [?id=2]. When the link directs the user to the page with the alert box, it sends [?id=1]. An if statement in the code behind is responsible for hiding the box if it is [?id=1]. After the user enters data and clicks a button to proceed to an emailing page, they are then redirected back to the original page with the alert box and [?id=2] is sent. The If statement reads the [?id=2] and displays a message confirming that the email went through. Clicking the alert [Okay] button triggers an increase in font size. Currently, both the If statement and JavaScript are placed within the Page Load function in the code behind. My question now is: where should I place the If statement (if at all) so that the css file attributes are not ignored upon reload?
Below is the example of the If statement within the page load function. How can I integrate this into the ASPX page or is there another approach I should consider?
If Request.QueryString("id") = "2" Then
Response.Write("<script language=""javascript"">alert('Your Early Order information has been sent to the Purchasing Department');</script>")
Else
'Do nothing
End If