please help me with this one question. so i have a page say page1.aspx, inside it has a link to another site. when i clicked on the link, it'd take me to another page that'd do some kindda validation, then redirects me back to the page i came from - page1.aspx - with the querystring, so then i'd ended up on the same page - same file name with a querystring - which is page1.aspx?messagestatus=fail, or page1.aspx?messagestatus=pass . then an alert box will pop and show a message depends on the status of the querystring (pass or fail)
The codes below works for me (i tested it by manually adding the ?messagestatus=pass or fail to the url), and i added the GetQString() function to the body onLoad. One problem is that I don't have access to the <body>
tag to add that onload function, is there another way to activate that function without touching the <body>
tag?
also, if you know of anything that works like this, but using a lightbox/modal box - please guide me there? thank you experts
here's my codes:
<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function querySt(Key) {
var url = window.location.href;
KeysValues = url.split(/[\?&]+/);
for (i = 0; i < KeysValues.length; i++) {
KeyValue= KeysValues[i].split("=");
if (KeyValue[0] == Key) {
return KeyValue[1];
}
}
}
</script>
<script type="text/javascript">
function GetQString(Key) {
if (querySt("messagestatus")) {
var value = querySt("messagestatus");
//alert(value);
if (value=='fail')
{
alert('Message:\nFailed!');
}
if (value=='pass')
{
alert('Message:\nPass!');
}
}
}
</script>
</head>
<body onload="GetQString();">
something here, <a href="#">this's the link that'll go out to another page, then redirects back to this page with the ?messagestatus=fail (or pass) querystring</a>.
</body>
</html>