variable in function - syntax

M

Marnix

Hi

I know only little of javascript and have trouble with the syntax of a
function

this is the function

function ClipBoard( VARIABLE)
{
holdVARIABLE.innerText = VARIABLE.innerText;
Copied = holdVARIABLE.createTextRange();
Copied.execCommand("Copy");
}

probably needless to say, but it doesn't work.
How can i get this function to work?

thanks in advance,

Marnix
 
G

Gill Bates

Looks like JScript to me, which is of course only similar to JavaScript or
EcmaScript.
Look at the JScript pages from MS if you really want to do this.

It would be handy to tell what you want the function to do.
 
D

DU

Marnix said:
Hi

I know only little of javascript and have trouble with the syntax of a
function

Maybe you're a newbie but you have at least one good coding technique:
you try to give meaningful, intuitive, self-explanatory identifiers to
your variables. And that helps debugging, review by others and code
reusability, etc..
this is the function

function ClipBoard( VARIABLE)
{
holdVARIABLE.innerText = VARIABLE.innerText;
Copied = holdVARIABLE.createTextRange();
Copied.execCommand("Copy");
}

probably needless to say, but it doesn't work.
How can i get this function to work?

thanks in advance,

Marnix

What do you want to do exactly? Let me guess. You want your
visitors/users to be able to somehow copy and store highlighted/selected
text from some place in your webpage?

Right now, your code only uses proprietary MSIE methods and properties.

Please describe your webpage situation, context, requirements, what you
want to do, et.. Best is to give an url along with your brief and
straightforward descriptions. Most people here will be able to figure
out the rest... unless you need to answer a few more questions.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
M

Marnix

Maybe you're a newbie but you have at least one good coding technique:
you try to give meaningful, intuitive, self-explanatory identifiers to
your variables. And that helps debugging, review by others and code
reusability, etc..

not really my product. I got it from this url
http://www.htmlgoodies.com/beyond/clipboard.html
i want to adjust the script to my sitution, but with my knowledge of js
it goes a little over my head.
What do you want to do exactly? Let me guess. You want your
visitors/users to be able to somehow copy and store highlighted/selected
text from some place in your webpage?
Right now, your code only uses proprietary MSIE methods and properties.

You are right. Images in a certain directory are listed. After clicking
the reference to the picture is copied to the clipboard and can be used
in a wysiwyg-editor.
Right again about the MSIE prop. Yet this isn't a problem, because the
site has a wysiwyg-editor which is MSIE only.
http://www.fredck.com/FCKeditor/
Please describe your webpage situation, context, requirements, what you
want to do, et.. Best is to give an url along with your brief and
straightforward descriptions. Most people here will be able to figure
out the rest... unless you need to answer a few more questions.

Images reside in a dir. This dir is listed on the site. Each image gets
a button "copy to clipboard". The text that must be copied to the
clipboard = /dirname/imagename
the site is protected by .htaccess, so i made an user "test".
http://test:[email protected]/ts/cms/images.php

thanks for your answers DU and Gill Bates.
I hope you're willing to take another look at it. thanks in advance.

Marnix
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,569
Members
47,206
Latest member
MalorieSte

Latest Threads

Top