I often use this code to toggle the visibility of a HTML element on the page. It is especially useful with forms and showing different option depending on what the user selects. Here is the code:-
function ToggleVis(element){var Target=document.getElementById(element);if(Target.style.display==""){
Target.style.display="none";}else{
Target.style.display="";}}
In the IWebBiz CMS individual content objects may need their own javascript code to process them. So I load each individual javascript file as needed. The code to do this is:-
function dhtmlLoadScript(url){var e = document.createElement("script");
e.src= url;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);}
I recently had a website that needed scrolling pictures from the right to the left. It was a photo album and it achieved this with a marquee tag. I also wanted to increase the speed of the scrolling via javascript so if the users went back to the page it would be simple to scroll back to the point they left at. Here is the code:-