show layer based on querystring value onload

What I am trying to do is SHOW a hidden div when the querystring variable Login = "Failed". So far I have got the variable value bit working and it is alerting that the value is "Failed" but actually showing the div is resulting in an error which is "Object required".

Do I need to add an event to the body dynamically in relation to the variable value and if so how do I do this?
HTML Page
--------------
<script language="javascript">
var qs = new Querystring()
var v1 = qs.get("Login");
alert(v1); //WORKS UP TO HERE
if(v1 == "Failed") {
	slidedown('mydiv');
}
 
 
JS FILE
--------------
var timerlen = 5;
var slideAniLen = 250;
 
var timerID = new Array();
var startTime = new Array();
var obj = new Array();
var endHeight = new Array();
var moving = new Array();
var dir = new Array();
 
function slidedown(objname){
        if(moving[objname])
                return;
 
        if(document.getElementById(objname).style.display != "none")
                return; // cannot slide down something that is already visible
 
        moving[objname] = true;
        dir[objname] = "down";
        startslide(objname);
}
 
function slideup(objname){
        if(moving[objname])
                return;
 
        if(document.getElementById(objname).style.display == "none")
                return; // cannot slide up something that is already hidden
 
        moving[objname] = true;
        dir[objname] = "up";
        startslide(objname);
}
 
function startslide(objname){
        obj[objname] = document.getElementById(objname);
 
        endHeight[objname] = parseInt(obj[objname].style.height);
        startTime[objname] = (new Date()).getTime();
 
        if(dir[objname] == "down"){
                obj[objname].style.height = "1px";
        }
 
        obj[objname].style.display = "block";
 
        timerID[objname] = setInterval('slidetick(\'' + objname + '\');',timerlen);
}
 
function slidetick(objname){
        var elapsed = (new Date()).getTime() - startTime[objname];
 
        if (elapsed > slideAniLen)
                endSlide(objname)
        else {
                var d =Math.round(elapsed / slideAniLen * endHeight[objname]);
                if(dir[objname] == "up")
                        d = endHeight[objname] - d;
 
                obj[objname].style.height = d + "px";
        }
 
        return;
}
 
function endSlide(objname){
        clearInterval(timerID[objname]);
 
        if(dir[objname] == "up")
                obj[objname].style.display = "none";
 
        obj[objname].style.height = endHeight[objname] + "px";
 
        delete(moving[objname]);
        delete(timerID[objname]);
        delete(startTime[objname]);
        delete(endHeight[objname]);
        delete(obj[objname]);
        delete(dir[objname]);
 
        return;
}
 
function toggleSlide(objname){
  if(document.getElementById(objname).style.display == "none"){
    // div is hidden, so let's slide down
    slidedown(objname);
  }else{
    // div is not hidden, so slide up
    slideup(objname);
  }
}
</script>
 
<body>
    <div id="mydiv" style="display:none; overflow:hidden; height:35px; width:920px; margin:0px auto; padding:0px 20px; background-color:#000; color:#fff;"> </div>

Open in new window

clearchannelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Here

You need the div to exist so you have to wait until after load

<script language="text/javascript">
var qs = new Querystring()
var v1 = qs.get("Login");
alert(v1); //WORKS UP TO HERE
window.onload=function() {
  if(v1 == "Failed") {
    slidedown('mydiv');
  }
}
</script>
 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clearchannelAuthor Commented:
Thanks. I thought it had somehitng to do with onload but wasn't sure.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.