displaying news with javascript

I keep coming up against this issue. Displaying news on a website. And I'd like to come up with a solution to use like a template, something I can just drop on a site easily.

The solution I keep seeing is an iframe with javascript to scroll the content. However, I'm really opposed to the idea of using iframes, I think the time for those has passed.

I want to use JS without a framework, because it disallows using other frameworks. Does anyone know where I could find something robust?

(I'm thinking of using vertical scrolling, but I'm also curious about other solutions)

-------------Problems Reply------------

Why don´t you take a div insert an other div an give the second div a nagative top value.

` function toTop(top_value) { if (top_value == 0) { document.getElementById('news').css.top = '0'; }

document.getElementById('news').css.top = '-5px'; } window.setTimeout('toTop(1)', 100); window.setTimeout('toTop(0)', 10000); ` This is untested, but I´ve done it this way.


I found a script that seems to wok well for me, maybe someone else will find this helpful

* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.

var delayb4scroll=1000; //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1; //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1; //Pause marquee onMousever (0=no. 1=yes)?
var tim;

var copyspeed=marqueespeed;
var pausespeed=(pauseit==0)? copyspeed: 0;
var actualheight='';

function scrollmarquee(){
//if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) {
if (document.getElementById('track').value == "") {
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) {
else {

//on mouse out
function mouse_out() {

function initializemarquee(){
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
setTimeout('lefttime=setInterval("scrollmarquee()",55)', delayb4scroll);

//event listener
if (window.addEventListener) {
window.addEventListener("load", initializemarquee, false);
else if (window.attachEvent) {
window.attachEvent("onload", initializemarquee);
else if (document.getElementById) {

the html:

<!-- scroll -->
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="vmarquee_content">
<input id="track" name="track" type="hidden" value="">

and the css:

position: relative;
width: 250px; /*marquee width */

height: 150px; /*marquee height */
background-color: white;
overflow: hidden;
border: 1px solid #666666;
padding: 2px;
padding-left: 4px;
.scroll_div {
border:solid 1px #3366FF;
width: 260px;
width/**/: 280px !important;
.vmarquee_content {
font-family:Arial, Helvetica, sans-serif;

Category:javascript Views:0 Time:2009-11-11

Related post

  • how to display xml in javascript? 2008-12-08

    As the question says, it just escaped my memory how to display xml in javascript, I want to display some source xml within an div on a page, that sits next to the processed result of the xml in another div. Can't remember if there was an equivalent t

  • Hide something with CSS without display:none or JavaScript 2008-12-12

    How can I hide the div without using display:none or JavaScript? In my country, a lot of Blackberrys come with the CSS support disabled (the mobile companies here are not so good to developers). I have text that says <div class="BBwarn"> please

  • Are there any pitfalls in displaying a "No JavaScript" warning in the following fashion? 2009-02-19

    I have a webpage that has a comment box that can be toggled by clicking a link (the opening and closing of the box is controlled using JavaScript, specifically JQuery). This box is hidden by default, so naturally, it's impossible to display without t

  • problem to display dynamically a javascript google ad in an iframe using jquery 2010-08-13

    We try to display the google ad in an iframe that we add dynamically. In an iframe, the field "src" is generally an url, but we want to use the data:text/html format to be able to use directly our ad code. It works for simple JavaScript code like a d

  • how to send database query result in json and display results in javascript? 2010-10-20

    Can any one give me example or reference for converting mysql database query results in to json object and send it to javascript file then parse the json and display results in javascript file using jquery? Thanks. --------------Solutions------------

  • How to display image with javascript? 2011-03-27

    I am trying to display image, through javascript, but i can't figure out how to do that. I have following function image(a,b,c) { this.link=a; this.alt=b; this.thumb=c; } function show_image() { document.write("img src="+this.link+">"); } image1=n

  • How can I put a string containing html text to be displayed in a javascript function? 2011-05-11

    How can I put a string containing html text to be displayed in a javascript function? String test = "DisplayNext(\"String containing html tags\")"; String NextLink = "<br><a href='#' onclick="+test+"> Next</a>"; Javascript function:

  • Display php using javascript 2011-08-19

    <p>Todays Date: <? echo $date; ?></p> <p>Are you applying for a day, evening, or weekend class? <select name='date' id='wclass'> <option value ='day'> Day</option> <option value ='evening'>Evening</o

  • Noscript tag's content being displayed even though JavaScript is enabled? 2009-08-20

    I've got a very simple snippet of HTML (below) - and both sections seem to be enabled - the script runs and the noscript tag's content shows. What's going on here? <SCRIPT language="JavaScript" type="text/javascript"> // script omitted </SCR

  • Validating Form Data and Displaying Graphics with JavaScript 2009-12-01

    I have not really used JavaScript before but I am trying to validate form elements as they are being filled out. I have an X and a Check mark that I am trying to display next to the field to show if it is valid or not. I know that this is partially r

  • FAQ displaying style in javascript 2009-12-31

    I have implemented the following javascript in my FAQ page: var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget = {}; Spry.Widget.CollapsiblePanel = function(element, opts) { this.init(element); Spry.Widget.CollapsiblePanel.setOptions(this,

  • to display calendar using javascript and php 2010-01-29

    im new to this PHP im trying to develop a code such that when i click launch calendar it ll display calendar and when i choose the date it ll display in the text field but my problem is when i clik launch calendar its not showing feburay month.. i do

  • Download file and display contents with javascript 2010-02-04

    I have a simple webpage which has a link, on pressing it a file is downloaded(rest web service call). I need to read the file and display the contents using javascript. How do I do this? --------------Solutions------------- If you have access to the

  • Can we display Hyperlink from Javascript alert on ASP.NET Page? 2010-02-23

    I have the following text that needs to be displayed from Javascript ALert. I am wondering if we can display the hyperlink from the alert itself? alert('User already exists in the system, please <a href='../Login.aspx'>login</a>'); Apprec

  • how to remove a div with same ids but display='block' and display='none' in JAVascript 2010-04-21

    I have more than 1 divs with same id, but one has diplay='block' and others have display='none'. I want to delete all the divs which have display='none'. Kindly tell the easiest way. --------------Solutions------------- It is against W3 Standards to

  • Capture *all* display-characters in JavaScript? 2010-04-21

    I was given an unusual request recently that I'm having the most difficult time addressing that involves capturing all display-characters when typed into a text box. The set up is as follows: I have a text box that has a maxlength of 10 characters. W

  • adding the text box values and display it using javascript 2010-06-28

    I'm trying to add the input values of several text boxes using javascript and display the total number below. How can I add and keep the sum for displaying after the computation. I'm not an expert in javascript. --------------Solutions------------- H

  • How to display image from JavaScript 2010-07-15

    How to display an image using JavaScript from an array creating in JavaScript. Any help please? Thanks. --------------Solutions------------- If you've got an image tag in your HTML layout, with a given id, you can control its content with javascript:

  • Sharepoint - display bug in javascript edited newform.aspx ( wss 3.0 ) 2010-08-06

    I took the generated newform.aspx file that has a select-field with 3 options. I now added some js/jquery code to display different fields for options 1/2/3 by taking the internal field name of the select-field and looking up what option is selected

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.098 (s). 11 q(s)