PhilipK Posted February 20, 2011 Share Posted February 20, 2011 Hello, I'm new to using javascript and have mainly used it for page includes up to this point. I have an idea for a small script but am looking for some help on the structure. I want to have a small piece of javascript, a small section of which, is changed based on the the url #anchor. The #anchor would be passed into a php include as the id of the object the javascript would act on. Quote Link to comment https://forums.phpfreaks.com/topic/228258-dynamic-javascript-based-on-anchors/ Share on other sites More sharing options...
trq Posted February 20, 2011 Share Posted February 20, 2011 And the problem is? Quote Link to comment https://forums.phpfreaks.com/topic/228258-dynamic-javascript-based-on-anchors/#findComment-1177103 Share on other sites More sharing options...
PhilipK Posted February 20, 2011 Author Share Posted February 20, 2011 To be more specific here is the code I have window.onload = function() { // open a welcome message as soon as the window loads Shadowbox.open({ content: '<div id="welcome-msg">Welcome to my website!</div>', player: "html", title: "Welcome", height: 350, width: 350 }); I want the id to equal what ever is in the anchor tag. So #websites would make <div id="websites"> Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/228258-dynamic-javascript-based-on-anchors/#findComment-1177128 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.