Hello
Hope you can help. I have been using the code below to move elenents around
the page. This has worked fine until I put some arguments into the functions
so I could use them in many places with out having to create lots of
slightly different functions. The code that has now stoped working is below.
My javascript is not great and I have been struggling with this all day. Can
anyone see where Ive gone wrong
Thanks
Ian
This first bit is two elements that will be dynamically moved around by
pressing buttons on a form (I have many of these but have only shown two).
*******code starts here***************
<div id='h1' style='position:absolute;left:<?php echo $xh1/2;?>px; top:<?php
echo $yh1/2;?>px; font-size:<?php echo $sh1/2;?>px; visibility:
visible;'><?php echo wordwrap($h1,$wh1, "<br />\n"); ?></div>
<div id='h2' style='position:absolute;left:<?php echo $xh2/2;?>px; top:<?php
echo $yh2/2;?>px; font-size:<?php echo $sh2/2;?>px; visibility:
visible;'><?php echo wordwrap($h2,$wh2, "<br />\n"); ?></div>
************************************************** **************************
*
These are the functions which do the moving. They have 3 arguments, one for
the number of pixels to move each time, one for the textfield that stores
the elements position, and one for the id of the element to be moved. Ive
used arguments in the functions instead of the actual values so that I can
reuse the functions with other blocks.
***code starts here *****
<script type="text/javascript" language="javascript">
<!--
/*var texttop=100;*/
var h1 = document.getElementById('h1');
var textleft =120;
var texttop = 0;
function ymove(amount,yposition,textstr {
texttop += amount;
textstr.style.top =texttop+'px';
document.form2.yposition.value = texttop*2;
}
function xmove(amount,xposition,textstr) {
textleft += amount;
textstr.style.left =textleft+'px';
document.form2.xposition.value = textleft*2;
}
//-->
</script>
************************************************** ***********************
This final bit is two buttons on either side of a text field, and when they
are clicked they call on the functions above. These then change the left and
top positions of the elements (the first bit of code)
I have a number of these blocks (only one shown below) each acting to move
an element around and storing its position in the textfield.
******code starts here**************
<input name="button23" type='button' class="BodyText"
onClick="xmove(-10,'xh1,'h1')"
value='<'>
<input name="xh1" type="text" class="BodyText" value="<?php echo
$xh1; // echo $row['xh1']; ?>" size="1">
<input name="button22" type='button' class="BodyText"
onClick="xmove(10,'xh1,'h1')"
value='>'>
</div></td>
<td nowrap class="BodyText"><div align="center">
<input name="button" type='button' class="BodyText"
onClick="ymove(-10,'yh1','h1')"
value='<'>
<input name="yh1"type="text" class="BodyText" value="<?php echo $yh1;
?>" size="1">
<input name="button2" type='button' class="BodyText"
onClick="ymove(10,'yh1','h1')"
value='>'> 4 1400
In article <aL*****************@newsfe4-win.ntli.net>, ia********@virgin.net says...
Hello
Hope you can help. I have been using the code below to move elenents around
the page.
It would help if you posted clearly formatted, client-side code, not
your PHP source.
--
Hywel http://kibo.org.uk/
mantrid wrote:
Hello
Hope you can help. I have been using the code below to move elenents around
the page. This has worked fine until I put some arguments into the functions
so I could use them in many places with out having to create lots of
slightly different functions. The code that has now stoped working is below.
My javascript is not great and I have been struggling with this all day. Can
anyone see where Ive gone wrong
I haven't tested you code, below are some suggestions...
[...]
***code starts here *****
<script type="text/javascript" language="javascript">
<!--
Ditch the deprecated language attribute (keep type) and get rid of the
HTML style comment delimiters.
/*var texttop=100;*/
var h1 = document.getElementById('h1');
var textleft =120;
var texttop = 0;
function ymove(amount,yposition,textstr {
texttop += amount;
textstr.style.top =texttop+'px';
document.form2.yposition.value = texttop*2;
}
function xmove(amount,xposition,textstr) {
textleft += amount;
textstr.style.left =textleft+'px';
document.form2.xposition.value = textleft*2;
}
//-->
</script>
************************************************** ***********************
This final bit is two buttons on either side of a text field, and when they
are clicked they call on the functions above. These then change the left and
top positions of the elements (the first bit of code)
I have a number of these blocks (only one shown below) each acting to move
an element around and storing its position in the textfield.
******code starts here**************
<input name="button23" type='button' class="BodyText"
onClick="xmove(-10,'xh1,'h1')"
You have unbalanced parenthesis here...
value='<'>
<input name="xh1" type="text" class="BodyText" value="<?php echo
$xh1; // echo $row['xh1']; ?>" size="1">
<input name="button22" type='button' class="BodyText"
onClick="xmove(10,'xh1,'h1')"
And here. There may be other problems.
[...]
--
Rob
>You have unbalanced parenthesis here...
Unfortunately they were just typo errors in my post.
"RobG" <rg***@iinet.net.auwrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
mantrid wrote:
Hello
Hope you can help. I have been using the code below to move elenents
around
the page. This has worked fine until I put some arguments into the
functions
so I could use them in many places with out having to create lots of
slightly different functions. The code that has now stoped working is
below.
My javascript is not great and I have been struggling with this all day.
Can
anyone see where Ive gone wrong
I haven't tested you code, below are some suggestions...
[...]
***code starts here *****
<script type="text/javascript" language="javascript">
<!--
Ditch the deprecated language attribute (keep type) and get rid of the
HTML style comment delimiters.
/*var texttop=100;*/
var h1 = document.getElementById('h1');
var textleft =120;
var texttop = 0;
function ymove(amount,yposition,textstr {
texttop += amount;
textstr.style.top =texttop+'px';
document.form2.yposition.value = texttop*2;
}
function xmove(amount,xposition,textstr) {
textleft += amount;
textstr.style.left =textleft+'px';
document.form2.xposition.value = textleft*2;
}
//-->
</script>
************************************************** ***********************
This final bit is two buttons on either side of a text field, and when
they
are clicked they call on the functions above. These then change the left
and
top positions of the elements (the first bit of code)
I have a number of these blocks (only one shown below) each acting to
move
an element around and storing its position in the textfield.
******code starts here**************
<input name="button23" type='button' class="BodyText"
onClick="xmove(-10,'xh1,'h1')"
You have unbalanced parenthesis here...
value='<'>
<input name="xh1" type="text" class="BodyText" value="<?php
echo
$xh1; // echo $row['xh1']; ?>" size="1">
<input name="button22" type='button' class="BodyText"
onClick="xmove(10,'xh1,'h1')"
And here. There may be other problems.
[...]
--
Rob
You can see what Im trying to do at the following. http://www.iddsoftware.co.uk/test.php
You can check the source and get a better idea of whats going on
Thanks again this one got me stumped and I dont really want to write lots of
little functions, its not very elegant
Ian
"mantrid" <ia********@virgin.netwrote in message
news:oU************@newsfe3-win.ntli.net...
You have unbalanced parenthesis here...
Unfortunately they were just typo errors in my post.
"RobG" <rg***@iinet.net.auwrote in message
news:44***********************@per-qv1-newsreader-01.iinet.net.au...
mantrid wrote:
Hello
Hope you can help. I have been using the code below to move elenents
around
the page. This has worked fine until I put some arguments into the
functions
so I could use them in many places with out having to create lots of
slightly different functions. The code that has now stoped working is
below.
My javascript is not great and I have been struggling with this all
day.
Can
anyone see where Ive gone wrong
I haven't tested you code, below are some suggestions...
[...]
***code starts here *****
>
<script type="text/javascript" language="javascript">
<!--
Ditch the deprecated language attribute (keep type) and get rid of the
HTML style comment delimiters.
/*var texttop=100;*/
var h1 = document.getElementById('h1');
var textleft =120;
var texttop = 0;
>
function ymove(amount,yposition,textstr {
texttop += amount;
textstr.style.top =texttop+'px';
document.form2.yposition.value = texttop*2;
>
}
>
function xmove(amount,xposition,textstr) {
textleft += amount;
textstr.style.left =textleft+'px';
document.form2.xposition.value = textleft*2;
}
//-->
</script>
>
************************************************** ***********************
>
This final bit is two buttons on either side of a text field, and when
they
are clicked they call on the functions above. These then change the
left
and
top positions of the elements (the first bit of code)
I have a number of these blocks (only one shown below) each acting to
move
an element around and storing its position in the textfield.
>
******code starts here**************
>
<input name="button23" type='button' class="BodyText"
onClick="xmove(-10,'xh1,'h1')"
You have unbalanced parenthesis here...
value='<'>
<input name="xh1" type="text" class="BodyText" value="<?php
echo
$xh1; // echo $row['xh1']; ?>" size="1">
<input name="button22" type='button' class="BodyText"
onClick="xmove(10,'xh1,'h1')"
And here. There may be other problems.
[...]
--
Rob
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steven D'Aprano |
last post by:
I'm trying to keep an open mind, but I am perplexed
about something in Python that strikes me as a poor design.
py> def func(a,b):
py> print a,b
py> func(1)
Traceback (most recent call...
|
by: Ireneusz SZCZESNIAK |
last post by:
I want to sort a vector with the std::sort function. There are two
functions: one with two arguments, the other with three arguments. I
am using the one with three arguments. I noticed that...
|
by: marktm |
last post by:
Hi-
I am trying to use setInterval to call a method within an object and
have not had any luck. I get "Object doesn't support this property or
method" when I execute the following code. What I...
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode...
|
by: Paul |
last post by:
hi, there,
for example,
char *mystr="##this is##a examp#le";
I want to replace all the "##" in mystr with "****". How can I do this?
I checked all the string functions in C, but did not...
|
by: Telmo Costa |
last post by:
Hi. I have the following code:
--------------------------------------
function Tunnel() {
//arguments(???);
}
function Sum() {
var sum = 0;
for (i=0; i<arguments.length; i++) sum +=...
|
by: Cuthbert |
last post by:
After compiling the source code with gcc v.4.1.1, I got a warning
message:
"/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the
'gets' function is dangerous and should not be...
|
by: Pacific Fox |
last post by:
Hi all,
haven't posted to this group before, but got an issue I can't work
out... and hoping to get some help here ;-)
I've got a base object that works fine with named arguments when called...
|
by: shuisheng |
last post by:
Dear All,
The problem of choosing pointer or reference is always confusing me.
Would you please give me some suggestion on it. I appreciate your kind
help.
For example, I'd like to convert a...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |