473,659 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copy filenaam in javascript function

Hi All,

I have a rather complicated problem.
I use following function to display a hyperlink:

a="<"+"a href='";
b3="<"+"a href='http://nww.";
L="</"+'a><br>';

function h(a){document.w riteln(a)}
function HN(link,tekst){ target=telt();i f
(wi==1)target=" _top";h(b3+link +"'"+tag+target +"'"+"onclick=' n(\""+target+"\ ",\""+"http ://nww."+link+"\", \""+tekst+"\")' "+">"+tekst +L)}

Now I need an additional option to store a filename like:
function HN(link,tekst, filename)

The function HN should be rearranged that when I click this hyperlink
the filename gets stored to the clipboard, so I can release it with
Ctrl-V.

For Example:
HN('nix.nothing .int/WHERE/2005','My
Hyperlink','NIX .NOTHING.TEXT.2 0050723.')

Where the last part: NIX.NOTHING.TEX T.20050723. is the part which needs
to be copied to the clipboard.

Anyone knows how I should change the function HN to get this done?
Or is it not possible?

Regards

Marco
The Netherlands

Jul 23 '05 #1
18 2199
ma************@ zonnet.nl wrote:
The function HN should be rearranged that when I click this hyperlink
the filename gets stored to the clipboard, so I can release it with
Ctrl-V.

For Example:
HN('nix.nothing .int/WHERE/2005','My
Hyperlink','NIX .NOTHING.TEXT.2 0050723.')

Where the last part: NIX.NOTHING.TEX T.20050723. is the part which
needs to be copied to the clipboard.

Anyone knows how I should change the function HN to get this done?
Or is it not possible?


function HN(link, tekst, clipdata) {
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}
...
}
JW

Jul 23 '05 #2
Janwillem,

Thanks for the help but where exactly should I add this piece of code?
Like this?

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
{target=telt(); if
(wi==1)target=" _top";h(b3+link +"'"+tag+target +"'"+"onclick=' n(\""+target+"\ "
,\""+"http://nww."+link+"\", \""+tekst+"\")' "+">"+tekst +L)}
}

Marco

"Janwillem Borleffs" <jw@jwscripts.c om> schreef in bericht
news:42******** *************** @news.euronet.n l...
ma************@ zonnet.nl wrote:
The function HN should be rearranged that when I click this hyperlink
the filename gets stored to the clipboard, so I can release it with
Ctrl-V.

For Example:
HN('nix.nothing .int/WHERE/2005','My
Hyperlink','NIX .NOTHING.TEXT.2 0050723.')

Where the last part: NIX.NOTHING.TEX T.20050723. is the part which
needs to be copied to the clipboard.

Anyone knows how I should change the function HN to get this done?
Or is it not possible?


function HN(link, tekst, clipdata) {
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}
...
}
JW

Jul 23 '05 #3
Marco Krechting wrote:
Janwillem,

Thanks for the help but where exactly should I add this piece of code?
Like this?

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
{target=telt(); if
(wi==1)target=" _top";h(b3+link +"'"+tag+target +"'"+"onclick=' n(\""+target+"\ "
,\""+"http://nww."+link+"\", \""+tekst+"\")' "+">"+tekst +L)}
}


No, because this will render the function useless to other browsers then IE.
The only part that needs to be excluded from other browsers is the
window.clipboar dData bit. Take the code I have shown you before and insert
the original function body below it:

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}

// Original function body
target=telt();

// I assume wi is defined somewhere?
if (wi==1) {
target="_top";
}
h(....);
}
JW

Jul 24 '05 #4
I tried the code listed below but it doesn't work:

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}

// Original function body
{target=telt();
if (wi==1)target=" _top";

h(b3+link+"'"+t ag+target+"'"+" onclick='n(\""+ target+"\",\""+ "http://nww."+li
nk+"\",\""+teks t+"\")'"+">"+te kst+L);
}

What went wrong?

Regards
MArco

"Janwillem Borleffs" <jw@jwscripts.c om> schreef in bericht
news:42******** *************** @news.euronet.n l...
Marco Krechting wrote:
Janwillem,

Thanks for the help but where exactly should I add this piece of code?
Like this?

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
{target=telt(); if
(wi==1)target=" _top";h(b3+link +"'"+tag+target +"'"+"onclick=' n(\""+target+"\ " ,\""+"http://nww."+link+"\", \""+tekst+"\")' "+">"+tekst +L)}
}

No, because this will render the function useless to other browsers then

IE. The only part that needs to be excluded from other browsers is the
window.clipboar dData bit. Take the code I have shown you before and insert
the original function body below it:

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}

// Original function body
target=telt();

// I assume wi is defined somewhere?
if (wi==1) {
target="_top";
}
h(....);
}
JW

Jul 24 '05 #5
Marco Krechting wrote:
I tried the code listed below but it doesn't work:

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}

// Original function body
{target=telt();
if (wi==1)target=" _top";

h(b3+link+"'"+t ag+target+"'"+" onclick='n(\""+ target+"\",\""+ "http://nww."+li
nk+"\",\""+teks t+"\")'"+">"+te kst+L);
}

What went wrong?


You added an erroneous opening brace:

{target=telt();

This should be:

target=telt();

Please look again closely to the example in my previous reply.
JW

Jul 24 '05 #6
Ok, tried again, the function is working but all text after where I run it
on the age is missing.

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}

// Original function body
target=telt();

// I assume wi is defined somewhere?
if (wi==1) {
target="_top";
}

h(b3+link+"'"+t ag+target+"'"+" onclick='n(\""+ target+"\",\""+ "http://nww."+li
nk+"\",\""+teks t+"\")'"+">"+te kst+L);
}

HN('nix.com/2005/','My Daily Report','DAILY. REPORT.')
------> after this all code on the page is missing....

Marco
"Janwillem Borleffs" <jw@jwscripts.c om> schreef in bericht
news:42******** *************** @news.euronet.n l...
Marco Krechting wrote:
I tried the code listed below but it doesn't work:

function HN(link,tekst,c lipdata){
// IE only
if (window.clipboa rdData) {
window.clipboar dData.setData(' text', clipdata);
}

// Original function body
{target=telt();
if (wi==1)target=" _top";

h(b3+link+"'"+t ag+target+"'"+" onclick='n(\""+ target+"\",\""+ "http://nww."+li nk+"\",\""+teks t+"\")'"+">"+te kst+L);
}

What went wrong?


You added an erroneous opening brace:

{target=telt();

This should be:

target=telt();

Please look again closely to the example in my previous reply.
JW

Jul 24 '05 #7
Marco Krechting wrote:
Ok, tried again, the function is working but all text after where I
run it on the age is missing.

Let's breakdown the function:
target=telt();
Is the telt() function correctly defined?
if (wi==1) {
Is wi defined as a global variable?
h(b3+link+"'"+t ag+target+"'"+" onclick='n(\""+ target+"\",\""+
"http://nww."+link+"\", \""+tekst+"\")' "+">"+tekst +L);


Is the h() function correctly defined?

Are the following variables globally defined:

b3
tag
L

Note that when variables not defined globally, should be defined in the
function itself.

BTW, a good JS debugging tool is FireFox's javascript console.
JW

Jul 24 '05 #8
Everything was working fine until I entered the copy clipboard code.

b3 = "<"+"a href='http://nww.";
tag = "target='"
L = "</"+'a><br>';
tel=0;function telt(){tel++;re turn tel};

I tried to use Firefox JS console, but how do I check a complete html-file?

Marco

"Janwillem Borleffs" <jw@jwscripts.c om> schreef in bericht
news:42******** *************** @news.euronet.n l...
Marco Krechting wrote:
Ok, tried again, the function is working but all text after where I
run it on the age is missing.


Let's breakdown the function:
target=telt();


Is the telt() function correctly defined?
if (wi==1) {


Is wi defined as a global variable?
h(b3+link+"'"+t ag+target+"'"+" onclick='n(\""+ target+"\",\""+
"http://nww."+link+"\", \""+tekst+"\")' "+">"+tekst +L);


Is the h() function correctly defined?

Are the following variables globally defined:

b3
tag
L

Note that when variables not defined globally, should be defined in the
function itself.

BTW, a good JS debugging tool is FireFox's javascript console.
JW

Jul 24 '05 #9
Janwillem Borleffs wrote:
Just call the script in FireFox, then look into the JS console to see
if there are errors.


That is: call the page that includes the script in FireFox. If this doesn't
bring up errors, then post an URL where the page can be viewed somewhere.
JW

Jul 24 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2211
by: Harag | last post by:
Hi all If I create an object with the following: var ob1 = new objMyDefinedObject(); then I assign it to a new variable. var ob2 = ob1
6
2078
by: @sh | last post by:
I know this is probably a real simple one, but I'm obviously missing something.. I'm building a function that I'll use throughout a website in the situation that I have two text boxes - the two text boxes will generally contain the same data. After the user completes the value of the first textbox, I want to onChange the value of the first textbox into the second textbox UNLESS the second textbox already has a value. Here's what I've...
2
13876
by: charles-brewster | last post by:
I'm trying to write a simple JavaScript function which will use a button to copy table cell data into a form input text box as the "value" attribute. The following is intended to test the function, but doesn't work. I'm new to this - previous JavaScript experience mostly copy & paste - could somebody please point to where I'm going wrong. ~~~~~~~~~~~~~~~~~~~~~~~~~ <head>
13
1831
by: Mounir | last post by:
Hi, Assume that right and left are multiple select elements. It's about the following line : right.options=left.options; It copies the content of left.options into right.options, but *removes* the content of the first one !
3
1584
by: zakhirn | last post by:
Hello, I have a search function that is reading companies from a database via ASP and spitting out the results. I have various fields of each company in variables and I want to be able to create a link that uses Javascript to copy the address to the clipboard. I know there is the javascript:window.clipboardData.getData(), but I can't get to parse the ASP variable through. Does anyone know how I can do this.
2
9960
by: zakhirn | last post by:
Hello, I have a search function that is reading companies from a database via ASP and spitting out the results. I have various fields of each company in variables and I want to be able to create a link that uses Javascript to copy the address to the clipboard. I know there is the javascript:window.clipboardData.getData(), but I can't get to parse the ASP variable through. Does anyone know how I can do this.
14
3267
by: Wouter | last post by:
Hi, I try to make the follow. I want that i can click on a text link and that then a link wil be copyed in a input form box (<input type="text" name="img_url" />). I have google-ed about how i can make this but i cant find a explane how i can do this. I'm sure my javascript skills are the problem.... Is there here someone who can help me whit this ?
10
3339
by: Sillu | last post by:
I'ld like to create a web page, from which no one can select the text simply, copy frm there n paste at another location. In simple means, i'ld like to stop copy process from my web page. Plz suggest JavaScript code for this purpose.
18
2093
by: WaterWalk | last post by:
Hello. Suppose there is an implementation of C++, in which when a class object is allocated, its member functions are also allocated in addition to its data members. So that every class object has a copy of all of its member functions. When a member function is called, it's the object's copy that When a class object is deallocated, the corresponding member functions are also deallocated. Don't consider optimization or performance, 1....
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.