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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing problems with a space.

Status
Not open for further replies.

jmorris

Programmer
May 2, 2000
15
AU
Javascript is not my language of expertise, so bare with me if you could.<br><br>I just wrote a short script which allows text to be passed from one window to another.&nbsp;&nbsp;It works fine with one word, but for 2 words (such as a full name) it does not work.&nbsp;&nbsp;I think tha fact that there is a space is not allowing it to work properly.<br><br>Does anyone have any suggestions as to how this could be handled.&nbsp;&nbsp;Thanks in advance for any help.<br><br>Jason Morris<br><A HREF="mailto:jmorris@pracom.com.au">jmorris@pracom.com.au</A><br><br>*****THE CODE******<br><br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;title&gt;Untitled&lt;/title&gt;<br>&lt;script language=&quot;javascript&quot;&gt;<br>&nbsp;&nbsp;&nbsp;function send(active){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parent.opener.document.formtest.name.value = (active)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &lt;/script&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br><br>&lt;!-- THIS WORKS --&gt;<br>&lt;a href=&quot;#&quot; onClick=send(&quot;John&quot;)&gt;John&lt;/a&gt;<br><br>&lt;!-- THIS DOESN'T WORK--&gt;<br>&lt;a href=&quot;#&quot; onClick=send(&quot;John Doe&quot;)&gt;John Doe&lt;/a&gt;<br><br><br><br>&lt;/body&gt;<br>&lt;/html&gt;<br><br>
 
Found the script below on <A HREF=" TARGET="_new"> this helps you :)<br><br><br><br>&lt;SCRIPT LANGUAGE=&quot;JavaScript&quot;&gt;&lt;!--<br>function setForm() {<br>&nbsp;&nbsp;&nbsp;&nbsp;opener.document.outputForm1.outputField1.value = document.inputForm1.inputField1.value;<br>&nbsp;&nbsp;&nbsp;&nbsp;opener.document.outputForm1.outputField2.value = document.inputForm1.inputField2.value;<br>&nbsp;&nbsp;&nbsp;&nbsp;self.close();<br>&nbsp;&nbsp;&nbsp;&nbsp;return false;<br>}<br>//--&gt;&lt;/SCRIPT&gt;<br><br>&lt;FORM NAME=&quot;inputForm1&quot; onSubmit=&quot;return setForm();&quot;&gt;<br>&lt;BR&gt;&lt;INPUT NAME=&quot;inputField1&quot; TYPE=&quot;TEXT&quot; VALUE=&quot;&quot;&gt;<br>&lt;BR&gt;&lt;INPUT NAME=&quot;inputField2&quot; TYPE=&quot;TEXT&quot; VALUE=&quot;&quot;&gt;<br>&lt;BR&gt;&lt;INPUT TYPE=&quot;SUBMIT&quot; VALUE=&quot;Update opener&quot;&gt;<br>&lt;/FORM&gt; <br><br> <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
A space inside a quoted string shouldn't be a problem when the string is passed as a parameter.&nbsp;&nbsp;<br><br>What results do you see when you use a space?<br> <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Basically I see nothing.&nbsp;&nbsp;<br><br>If it is working, when I click the hyperlink, the value is passed to the form in the opener window.<br><br>If is not working, when I click the hyperlink, absolutely nothing happens.&nbsp;&nbsp;It is just dead.<br><br>Thanks for your reply.<br><br>Jason Morris
 
<br>Jason,<br>&nbsp;&nbsp;You just need to enclose the onClick handler in quotes:<br><br>change <br><br>onClick=send(&quot;John Doe&quot;)<br><br>to<br><br>onClick='send(&quot;John Doe&quot;)' <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top