Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I add this JS code into my website?

Featured Replies

Hi,

 

Ive just edited some JavaScript code so that I can have a drop down menu built into my website.

 

I have finished the code to match my website http//www.rugbyleaguetoday.co.uk but am not sure how to add it into my website now.

 

Here is the Java Script code which is in the form of a file:

 

fixMozillaZIndex=true;
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;




with(mm_style()){
bordercolor="#252525";
borderstyle="solid";
borderwidth=1;
fontfamily="Verdana";
fontsize="10";
fontstyle="normal";
headerbgcolor="#CBEA1D";
headercolor="#252525";
offbgcolor="#252525";
offcolor="#CBEA1D";
onbgcolor="#252525";
oncolor="#ffffff";
outfilter="randomdissolve(duration=0)";
overfilter="Fade(duration=0);Alpha(opacity=100);Shadow(color=#252525', Direction=135, Strength=1)";
padding=4;
pagebgcolor="#252525";
pagecolor="black";
separatorcolor="#252525";
separatorsize=1;
subimagepadding=2;
}

with(menuname("Main Menu")){
alwaysvisible=1;
orientation="vertical";
style=menuStyle;
aI("text=Home;url=http://www.rugbyleaguetoday.co.uk/;");
aI("text=Blogs;url=http://www.rugbyleaguetoday.co.uk/blogs.php;");
aI("showmenu=Downloads;text=Downloads;");
aI("text=Forums;url=http://www.rugbyleaguetoday.co.uk/forum.php;");
aI("text=Links;url=http://www.rugbyleaguetoday.co.uk/links.php;");
aI("showmenu=My Team;text=My Team;");
aI("text=News;url=http://www.rugbyleaguetoday.co.uk/news.php;");
aI("text=Staff;url=http://www.rugbyleaguetoday.co.uk/staff.php;");


}

with(menuname("My Team")){
overflow="scroll";
style=menuStyle;
aI("text=Bradford Bulls;url=http://www.rugbyleaguetoday.co.uk/bradford.php;")
aI("text=Castleford Tigers;url=http://www.rugbyleaguetoday.co.uk/castleford.php;")
aI("text=Catalans Dragons;url=http://rugbyleaguetoday.co.uk/catalans.php;")
aI("text=Celtic Crusaders;url=http://rugbyleaguetoday.co.uk/celtic.php;")
aI("text=Harlequins RL;url=http://rugbyleaguetoday.co.uk/harlequins.php;")
aI("text=Huddersfield Giants;url=http://rugbyleaguetoday.co.uk/huddersfield.php;")
aI("text=Hull FC;url=http://rugbyleaguetoday.co.uk/hullfc.php;")
aI("text=Hull Kingston Rovers;url=http://rugbyleaguetoday.co.uk/hullkr.php;")
aI("text=Leeds Rhinos;url=http://rugbyleaguetoday.co.uk/leeds.php;")
aI("text=Salford City Reds;url=http://rugbyleaguetoday.co.uk/salford.php;")
aI("text=St.Helens;url=http://rugbyleaguetoday.co.uk/saints.php;")
aI("text=Wakefield Trinity Wildcats;url=http://rugbyleaguetoday.co.uk/wakefield.php;")
aI("text=Warrington Wolves;url=http://rugbyleaguetoday.co.uk/warrington.php;")
aI("text=Wigan Warriors;url=http://rugbyleaguetoday.co.uk/wigan.php;")

}

with(menuname("Downloads")){
style=menuStyle;
aI("text=Advertise Us;url=http://rugbyleaguetoday.co.uk/advertise.php;");
aI("text=Avatars;url=http://rugbyleaguetoday.co.uk/avatars.php;");
aI("text=Banners;url=http://rugbyleaguetoday.co.uk/banners.php;");
aI("text=Desktops;url=http://rugbyleaguetoday.co.uk/desktops.php;");
aI("text=Userbars;url=http://rugbyleaguetoday.co.uk/userbars.php;");

}

drawMenus();

 

Any help would be greatly appreciated, thanks.

In your <head>:

 

<script type="text/javascript" src="/linkto/file.js"></script>

  • Author

Ive just tried this and nothing appears to be showing...

 

Is they something wrong with my JS coding because it looks ok to me?

Did you copy/paste the JS you provided into a seperate file and name it something like "filename.js" (obviously changing it to what you want). Then you include the script provided by skidz in the head of your page, as well as defining the path to your "filename.js" file where skidz has put: src="/linkto/file.js"

You're calling drawMenus(); but I don't see that function in your code. Is there more code than this on another file somewhere?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.