Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Mouse Click Effect

Reply
Thread Tools

Mouse Click Effect

 
 
gcc
Guest
Posts: n/a
 
      11-22-2004
What I want to do is put a bunch of images on a page for use in php forum
boards, I will be hosting the images for forum users to post as avatars

I want the user to be able to go to the Image page, Click the picture and
have the url to that picture appear in a text box directly below that
picture with a "Copy" button next to it that copys the url to the users
clipboard.

Pretty basic i know, But i am still a beginner

TIA


 
Reply With Quote
 
 
 
 
Jeffrey Silverman
Guest
Posts: n/a
 
      11-22-2004
On Mon, 22 Nov 2004 16:00:41 +0000, gcc wrote:

> What I want to do is put a bunch of images on a page for use in php forum
> boards, I will be hosting the images for forum users to post as avatars
>
> I want the user to be able to go to the Image page, Click the picture and
> have the url to that picture appear in a text box directly below that
> picture with a "Copy" button next to it that copys the url to the users
> clipboard.
>
> Pretty basic i know, But i am still a beginner
>
> TIA


Use these pieces, not necessarily in this order:

[1] onClick() method
[2] document.getElementById('whatever').value to change the value of the
text input (example: <input type="text" id="whatever">)
[3} make sure to give all the relevant pieces id's. (example: <div
id="imagethumb">
[4] a PHP array of the image, image name, and/or image URL that you will
loop over and print out the relevant bits.

Putting the pieces together is for you to figure out. If you get stuck,
let me know.

I'm not so certain you can copy stuff to a "clipboard" memory space using
JavaScript, though. In fact, I'm pretty sure you can't. (At least, you
*shouldn't* be able to access a "clipboard" memory space with JavaScript
for security reasons).


--
Jeffrey D. Silverman | http://www.velocityreviews.com/forums/(E-Mail Removed)
Website | http://www.newtnotes.com

Drop "PANTS" to reply by email

 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      11-22-2004
On Mon, 22 Nov 2004 11:21:08 -0500, Jeffrey Silverman
<(E-Mail Removed)> wrote:

> I'm not so certain you can copy stuff to a "clipboard" memory space using
> JavaScript, though. In fact, I'm pretty sure you can't. (At least, you
> *shouldn't* be able to access a "clipboard" memory space with JavaScript
> for security reasons).


So guess which browser lets you do just that?

Steve
 
Reply With Quote
 
Jeffrey Silverman
Guest
Posts: n/a
 
      11-22-2004
On Mon, 22 Nov 2004 16:23:21 +0000, Steve Pugh wrote:

> (At least, you
>> *shouldn't* be able to access a "clipboard" memory space with JavaScript
>> for security reasons).

>
> So guess which browser lets you do just that?
>
> Steve


I'm gonna guess MSIE. Is it JavaScript or ActiveX that lets you do this,
though?

--
Jeffrey D. Silverman | (E-Mail Removed)
Website | http://www.newtnotes.com

Drop "PANTS" to reply by email

 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      11-22-2004
On Mon, 22 Nov 2004 12:07:25 -0500, Jeffrey Silverman
<(E-Mail Removed)> wrote:

> On Mon, 22 Nov 2004 16:23:21 +0000, Steve Pugh wrote:
>
>> (At least, you
>>> *shouldn't* be able to access a "clipboard" memory space with
>>> JavaScript
>>> for security reasons).

>>
>> So guess which browser lets you do just that?
>>

> I'm gonna guess MSIE. Is it JavaScript or ActiveX that lets you do this,
> though?


Yep, MSIE. JavaScript I think. I don't know the details 'cos I've never
had any need or desire to so such a thing. But people keep on posting on
the Opera newsgroups asking why Opera doesn't support this.

Steve
 
Reply With Quote
 
Mitja
Guest
Posts: n/a
 
      11-22-2004
On Mon, 22 Nov 2004 16:23:21 -0000, Steve Pugh <(E-Mail Removed)> wrote:

> On Mon, 22 Nov 2004 11:21:08 -0500, Jeffrey Silverman
> <(E-Mail Removed)> wrote:
>
>> I'm not so certain you can copy stuff to a "clipboard" memory space
>> using
>> JavaScript, though. In fact, I'm pretty sure you can't.

So was I... Then I searched and found the link below. Really surprised me.

> So guess which browser lets you do just that?

Mommy said no naughty language, so no elaborating about my opinion on JS
clipboard access.
http://www.htmlgoodies.com/beyond/clipboard.html

--
Mitja
 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      11-22-2004
Mitja wrote:

> http://www.htmlgoodies.com/beyond/clipboard.html


Two paragraphs after telling me that clicking the button would copy text to
my clipboard, then telling me it needs IE 4.0 or better it contradicts
itself by saying it will ONLY work in IE (So it won't work in my browser,
and it won't work in the better-then-IE-4.0 browser that I use).

It then goes on to the truly delightful bit of CSS which attempts to use the
height and width properties on a span (without making it a block) where
they don't apply, and giving them non-zero lengths without units (which
browsers should ignore).

Looks like "Joe Burns, Ph.D." is as good at writing about webpage authoring
as ever.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
Lenny Linux
Guest
Posts: n/a
 
      11-22-2004
TRY-----this for copy to clipboard from the form - [getit] - and -
[picurl] - textbox --textbox is locked from character entering by users.

<form name="getit">
<INPUT TYPE="TEXT" NAME="picurl" size="28" onFocus="this.blur()">
<INPUT TYPE="BUTTON" VALUE="Copy To Clipboard"
onClick="document.getit.picurl.select(); document.execCommand('Copy');">
</form>


"gcc" <(E-Mail Removed)> wrote in message
news:J2ood.31764$(E-Mail Removed). com...
> What I want to do is put a bunch of images on a page for use in php forum
> boards, I will be hosting the images for forum users to post as avatars
>
> I want the user to be able to go to the Image page, Click the picture and
> have the url to that picture appear in a text box directly below that
> picture with a "Copy" button next to it that copys the url to the users
> clipboard.
>
> Pretty basic i know, But i am still a beginner
>
> TIA
>
>



 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      11-23-2004
Lenny Linux wrote:

> TRY-----this for copy to clipboard from the form - [getit] - and -
> [picurl] - textbox --textbox is locked from character entering by users.
>
> <form name="getit">
> <INPUT TYPE="TEXT" NAME="picurl" size="28" onFocus="this.blur()">
> <INPUT TYPE="BUTTON" VALUE="Copy To Clipboard"
> onClick="document.getit.picurl.select(); document.execCommand('Copy');">
> </form>


Could you provide an example page where this works please?

--
Cheers
Richard.


 
Reply With Quote
 
Lenny Linux
Guest
Posts: n/a
 
      11-23-2004
Copy and paste the code below into notepad and save as - copyit.htm - on
your desktop.

Than open the webpage copyit.htm and hit the copy button. open notepad and
right click to paste text.



<html>
<head>
<title>testit</title>
</head>
<body bgcolor="0000ff">
<form name="getit">
<INPUT TYPE="TEXT" NAME="picurl" size="28" value="this text box"
onFocus="this.blur()">
<INPUT TYPE="BUTTON" VALUE="Copy To Clipboard"
onClick="document.getit.picurl.select(); document.execCommand('Copy');">
</form>
</body>
</html>





"rf" <rf@.invalid> wrote in message
news:Bsxod.45383$(E-Mail Removed)...
> Lenny Linux wrote:
>
> > TRY-----this for copy to clipboard from the form - [getit] - and -
> > [picurl] - textbox --textbox is locked from character entering by

users.
> >
> > <form name="getit">
> > <INPUT TYPE="TEXT" NAME="picurl" size="28" onFocus="this.blur()">
> > <INPUT TYPE="BUTTON" VALUE="Copy To Clipboard"
> > onClick="document.getit.picurl.select(); document.execCommand('Copy');">
> > </form>

>
> Could you provide an example page where this works please?
>
> --
> Cheers
> Richard.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
This code requires the user 2 click the mouse twice, how do i do itin just one mouse-click? Daniish Javascript 2 06-13-2008 08:41 PM
Menu Control - Expand items on mouse click rather than mouse hover =?Utf-8?B?am9qb2Jhcg==?= ASP .Net 1 10-02-2006 03:41 AM
Heres a mouse theres a mouse what a mouse do? unholy Gaming 37 09-17-2006 08:59 AM
click() function does not have same effect as real click (IE 6) Lazlo Woodbine Javascript 1 05-14-2004 08:52 PM
ASP.Net Datagrid get Cell Contents on mouse click or mouse down Davisro ASP .Net 2 04-23-2004 07:18 PM



Advertisments