Set document title

Share your advanced knowledge/code with the community.
sworteu
Posts: 18
Joined: Sun Feb 07, 2016 9:49 am

Set document title

Post by sworteu »

To set the document title:

Code: Select all

EnableJS
document.title = "My title"
DisableJS
I've put this in a external file, where i have all my javascript.
Then just include it at the beginning using XIncludeFile "myfile.sb"
I hope anyone finds it usefull.
User avatar
SparrowhawkMMU
Posts: 281
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Set document title

Post by SparrowhawkMMU »

+1 many thanks
sworteu
Posts: 18
Joined: Sun Feb 07, 2016 9:49 am

Re: Set document title

Post by sworteu »

SparrowhawkMMU wrote:+1 many thanks
If you need more tricks let me know. Pb and js are languages i know well.
hotcore
Posts: 14
Joined: Wed Jun 29, 2016 10:18 am

Re: Set document title

Post by hotcore »

Is something like this possible:

File "title.sb"

Code: Select all

EnableJS
document.title = myTitle
DisableJS
In some other source:

Code: Select all

myTitle = "My nice project"
xincludefile "title.sb"
hotcore
Posts: 14
Joined: Wed Jun 29, 2016 10:18 am

Re: Set document title

Post by hotcore »

Found it; use:

Code: Select all

EnableJS
document.title = v_myTitle
DisableJS
User avatar
SparrowhawkMMU
Posts: 281
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Set document title

Post by SparrowhawkMMU »

I think it needs to be "v_mytitle" i.e. all lower case.
hotcore
Posts: 14
Joined: Wed Jun 29, 2016 10:18 am

Re: Set document title

Post by hotcore »

Thx. Had it working already (with lowercase name ;-)
Post Reply