Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

click hyperlink - passes value back to parent window 1

Status
Not open for further replies.

schase

Technical User
Joined
Sep 7, 2001
Messages
1,756
Location
US
Hi all,

Ok, i've seen how to do this with selects and images. but how do i do it clicking a simple a href tag?

I've tried this

<a href=# onClick=sendImg(this);>&quot; & imagename & &quot;</a>

(it gets the values through asp)

and on top of that popup window i've got this

<script type=&quot;text/javascript&quot;>
function sendImg(sel) {
opener.document.forms[0].txtImage1.value = sel[sel.selectedIndex].text;
window.close();
}
</script>

but how do i modify that to look for a link rather than a select box?

Thank you.

&quot;Never underestimate the power of determination&quot;

Stuart
 
<a href=# onClick=sendImg(&quot;&imageName&&quot;);>&quot; & imagename & &quot;</a>&quot;


<script type=&quot;text/javascript&quot;>
function sendImg(sel) {
opener.document.forms[0].txtImage1.value = sel;
window.close();
}
</script>


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Oopps! Forgot the quotes....

&quot;<a href=# onClick=sendImg('&quot; & imageName & &quot;');>&quot; & imagename & &quot;</a>&quot;


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
thanks - perfect!

&quot;Never underestimate the power of determination&quot;

Stuart
 
hmmmm

it doesnt like any images with spaces in the filename.

Any way around this?

&quot;Never underestimate the power of determination&quot;

Stuart
 
Try to use %20 where the spaces are in the filename..

Example:

My Documents

would be

My%20Documents
 
since you are writing the filenames in asp you can say server.urlEncode(filename) and it will make sure that the filename is in correct URL code

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
You can also use the id attribute-


<a href =&quot;#&quot; id = &quot;test Id&quot; onclick=&quot;A(this.id)&quot;>###</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top