Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
<script type="text/javascript">
<!--
//Created by Justin
//Special thanks to Alex and Wrighty of SZ

if(pb_username=="Guest"){
    document.write('Hello Guest, Please login or Register');
}else[red] if(pb_username!="Guest")[/red]{
    var Message_Font=document.getElementsByTagName('font').item(2).innerHTML;
    var New_Messages=(Message_Font.match(/<\/a>, (.+?) (is|are) new./i))? RegExp.$1 : '';
    var Total_Messages=(Message_Font.match(/>(.+?) message(s)?<\/a>/i))? RegExp.$1 : '';
    [blue]document.write("Welcome " + pb_displayname + ", you have " + New_Messages + " new messages");[/blue]
}
//-->
</script>


That's what you'll want ..

I've added in the blue for you - just read it and see if there's anything that you don't get. The red isn't actually needed! :)

Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
Ah, im starting to understand it now :P, thank you

now all i have to do is add the table code below that code, right?
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
You can add the table above & below it - and put that part inside the <td> that you want it to appear in! :)

Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
is their a tutorial anywhere where i can learn how to make Document.write Tables? (since i havent learned that quite yet) or td?
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
document.write can be used with any HTML within the parentheses. What you're thinking of is DOM construction of tables. That's something a little more advanced at the moment! :)



Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
ah, i`ll skip the advanced for now, is their an easier way? :P


Last Edit: Aug 17, 2009 23:19:47 GMT by Justin
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
As I said you can just put plain HTML outside of the <script></script> tags - and place the coding where you want it to appear within the table.

:)

If you want an example, I'll show ya one! :)

Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
yeah, i think its best for you to show me one so i dont mess up :P
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
ok not a PM bar - but it'll give you the idea: (coded from scratch so might not work)....

<table width = '92%' border = '0'>
<tr>
<td>
<script>
document.write('Welcome ' + pb_username);
</script>

</td>
<td>
This is the right box!
</td>
</tr>
</table>


As you can see the document.write() function is just within the <td></td> element of the table. :)


Last Edit: Aug 17, 2009 23:34:10 GMT by Michael

Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
ah i get it, thanks Wrighty :), i`ll see what i can do with it =)
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
:)

Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
Tried it somewhat using your table until i get the basic hang of it, i havent touched the right box yet, id just like for you to look it over and see if everything is right so far.

<table width = '92%' border = '1'>
<tr>
<td>
<script>
document.write(Welcome " + pb_displayname + ", you have " + New_Messages + " new messages);
</script>
</td>
<td>
Right box here
</td>
</tr>
</table>
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
You need to place the WHOLE of your code from earlier in those script tags, not just the document.write() because as I mentioned earlier, it doesn't know the variables to use 'cause they're not defined. :)

Justin

Justin Avatar
:)

****
Senior Member

256


July 2009
Ah got it now :P, thanks :)

ok now this is probably my last question, is their a way i can move it from Below the ad to Below the Menubg/above the ad?
My signature
[/left][/i][/size]

Michael

Michael Avatar
*Has a custom title*



1,462


October 2007
This is where you'll require some DOM if I get you correctly,

Do you want it attached to the welcome table? :)

newBookmarkLockedFalling