Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
javascript veriable help in a ie info box script !!!
Old 04-29-2007, 12:50 PM javascript veriable help in a ie info box script !!!
Skilled Talker

Posts: 87
Trades: 0
Hi fist of all thanks for looking,

I know absolutly nothing about javascript so i am hoping someone can guide me the right way..

i have been trying to use the little script bellow to emulate the IE infobox on my website. the problemb is the infobox is surosed to hide itself when some has registered but it doesnt,

Code:
<head>
<link rel="stylesheet" href="infobar.css" type="text/css" /> <script type="text/javascript"> <!--
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");
}
</script> </head> 
</head>

<body> <table width="100%" border="0" cellspacing="0" cellpadding="0" > <tr> <td width="100%"> <div id="infobar"><a href="http://www.gamesvolcano.com/index.php?params=register/register/">It appears you have not yet registered to gamesvolcano.com. To register please click here...</a></div> </td> </tr> </table></body>
I presume it either looks at the browsers history to see if someone has visit the register page or looks for a div tag on the register page???

but i have tried to put a <div id='szDivID'></div> on the register page of my site http://www.gamesvolcano.com/index.ph...ster/register/
and it didnt hide the infobox when i revisited mainpage http://gamesvolcano.com

If you need to login use... userid=test password=test

Any help apreciated, Thanks
Attached Files
File Type: zip infobarcss.zip (580 Bytes, 2 views)
__________________
LOADS OF FREE GAMES FOR YOUR SITE @
Please login or register to view this content. Registration is FREE
higgylm is offline
Reply With Quote
View Public Profile Visit higgylm's homepage!
 
 
Register now for full access!
Old 04-29-2007, 01:20 PM Re: javascript veriable help in a ie info box script !!!
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Well dude...the reason you're seeing that is because you're using toggleBox as a function but not calling it from somewhere.

You need to call it at some point in your code, either by using body onload="toggleBox(other stuff here)" or at some point in your code.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 04-29-2007, 09:17 PM Re: javascript veriable help in a ie info box script !!!
Extreme Talker

Posts: 169
Trades: 0
The way I see it the first thing you need to do is clean your code a bit, what a mess, even if it just is an example (I do hope so... as in your not really using that unformatted mess)
Code:
<html>
  <head>
    <title>xYz</title>
    <link rel="stylesheet" href="infobar.css" type="text/css" />
    <script type="text/javascript">
      function toggleBox(szDivID, iState) // 1 visible, 0 hidden
      {
        var obj = document.layers ? document.layers[szDivID] :
        document.getElementById ?  document.getElementById(szDivID).style :
        document.all[szDivID].style;
        obj.visibility = document.layers ? (iState ? "show" : "hide") :
        (iState ? "visible" : "hidden");
      }
    </script>
  </head>

  <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
      <tr>
        <td width="100%">
          <div id="infobar">
            <a href="http://www.gamesvolcano.com/index.php?params=register/register/">It appears you have not yet registered to gamesvolcano.com. To register please click here...</a>
          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
And as Adam said, what use is it to write a function that is never called?
The way I see it the easiest thing to do would be to base your script off a cookie. Your site must set a cookie for regged members, so write a script that takes no vars (there isn't a need) and is loaded with window.onload (for instance).
This script should then check if there even is a cookie, if there is read it, if it says the user is registered then remove the info bar, get the div with getElementById('infobar') and then .removeChild and you should be all set.
I don't work with cookies in JS so no idea about that part.
Or you could borrow some knowledge and base anything further on that
__________________
George Bush would never take me alive.
MJM_RDS is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to javascript veriable help in a ie info box script !!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24877 seconds with 13 queries