|
Post by Wild Hooves on Dec 7, 2007 20:02:51 GMT -5
OK. Im trying to teach myself JavaScript to be able to start learning how to make things for Proboards.
OK. I figured out how to make pop up boxes. Is it possible to limit when they come up? (besides changing headers & footers)
<script type="text/javascript"> <!--
alert("Hello and Welcome to Wild Horse");
//--> </script>
That is the code I used. It's plain and simple. Is there anything to add to it that'll let me say when to come up?
And if I wanted to code my own mini-profile, where would I start?
|
|
iAlex
Junior Member
Posts: 73
|
Post by iAlex on Dec 7, 2007 20:23:10 GMT -5
You could use 'setTimeout', so that the message pops up after a certain amount of time. <script type="text/javascript"> <!--
function Pop(){ alert("Hello and Welcome to Wild Horse"); } setTimeout('Pop()', 5000);
//--> </script>
In that example your message would pop up after five seconds. You could also use an event, so that message will pop up when the user clicks on something, hovers there mouse on something or whatever. setTimeout: ClickFunctions: ClickEvent References: ClickMini-profile modifications can be somewhat of pain since there are different factors to take into consideration (Whether the user has their gender displayed, has an avatar, has a custom title etc). But I suppose if you wanted to make a mini-profile code, then you might want to look into regular expressions. RegExp characters: Click
|
|
|
Post by Wild Hooves on Dec 7, 2007 20:32:27 GMT -5
Ok I'll deal with a mini profile later on. just curious.
How would I add an event to the coding? I cant seem to find that.
|
|
iAlex
Junior Member
Posts: 73
|
Post by iAlex on Dec 7, 2007 20:57:36 GMT -5
Ok I'll deal with a mini profile later on. just curious. How would I add an event to the coding? I cant seem to find that. It really depends on what element you want to add the event to. You could have it so that when a specific image is clicked that the pop up will appear or when a user hovers their mouse over a table then that pop up will appear. In this example, the pop up will appear when your mouse hovers over the button. So, I have attached the function "Pop()" to execute when the input element is hovered over: <script type="text/javascript"> <!--
function Pop(){ alert("Hello and Welcome to Wild Horse"); }
//--> </script> <input type="submit" onmouseover="Pop()" />
In this example the pop up will appear when the page is completely loaded. The event has been attached to the window: <script type="text/javascript"> <!--
window.onload=function(){ alert("Hello and Welcome to Wild Horse"); }
//--> </script>
And in this example the pop up will appear when you leave a page: <script type="text/javascript"> <!--
window.onunload=function(){ alert("Hello and Welcome to Wild Horse"); }
//--> </script>
In those three examples, the red text is the event that has been added. The link of event references in my last post will provide you with all the different events you can use, the link will also provide you with a list of elements that you can attach those specific events to. (Some further reading you may be interested in when you understand events: Click)
|
|
|
Post by Wild Hooves on Dec 7, 2007 21:00:58 GMT -5
Thanks! The one I was trying to figure out was the leaving one.
|
|