473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Moving HTML elements (div)

Hi all,

a quick one here.
I am moving elements on the page clientside and I am going through strange issues.

This one works:

<html>
<head>
<title>Javascript Text</title>
</head>

<body>

<h1 id="title"> DHTML Animation </h1>

<script>

var e = document.all.title;
e.style.position = "absolute";
var frame = 0;

function nextFrame() {

if ( 20 > frame++)
{
e.style.left = (10 * frame) + "px";
setInterval("nextFrame();", 100);
}
}

nextFrame();

</script>

</body>

</html>

This one doesn't:

<html>
<head>
<title>Javascript Text</title>
</head>

<body>

<div id="title"> DHTML Animation </div>
<input type="button" value="click me to move it!" OnClick="move();">

<script>

function move()
{

var frame = 0;
nextFrame(frame);

}

function nextFrame(frame) {

var e = document.all.title;
e.style.position = "absolute";

var fr = frame;

if ( 20 > fr++)
{
e.style.left = (10 * fr) + 'px';
setInterval('nextFrame(' + fr + ');', 100);
}

}
</script>

</body>

</html>

I am getting Permission Denied when accessing (or trying to) the style in the move function.

Any one able to help me?

Thanks in advance,

Cheers,

JI
Apr 3 '07 #1
1 3108
My button didn't have an ID ... now it works, I think it was that.

Cheers,

JI
Apr 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: JLP | last post by:
Hello, I have a couple of hundred books in TEI based XML. I want to output html and pdf documents. I started building my own style sheets to do this and I ran into a problem with footnotes. Many...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
10
by: Rithish | last post by:
I want to emulate paging in an HTML document. something like, ------------------------- | | | <DIV> | | | | <TABLE></TABLE>...
10
by: Peter Kirk | last post by:
Hi there can someone please help me with creating dynamic content in a table? For example, see the below javascript and html - why is a new row not created in the table when I click the button?...
10
by: Mark McLellan | last post by:
Dear all Following the oft-repeated advice here and ciwas I have made my site nearly 4.01 strict (working on it). There are some items on which I would appreciate your advice: 1. Hidden...
4
by: Nick Wedd | last post by:
I have a test page http://www.files.maproom.org/00/12/q/w.html which almost does what I want. The idea is that, when you hover the mouse over one of the dates near the top of the page, it...
2
by: vunet.us | last post by:
Please, explain an interesting phenomenon, if you can. I have an array of references to an HTML element: <div id='container'> <div id='someId1'></div> <div id='someId2'></div> </div> ........
10
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. Have a simple Browser detect script to sort IE...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.