ANOTHER NEWBIE QUESTION: String Concatenation 
Author Message
 ANOTHER NEWBIE QUESTION: String Concatenation

I1ve got the following line offending:

            tag = '<a class="regularLink" href="javascript:SubmitForm(' &
"'" & (x - 1) & "'" & ', ' & "'" & url & "'" & ')" onmouseover="IconMSOver('
& cell_index & ')" onmouseout="IconMSOut(' & cell_index & ')"
onclick="this.blur()" title="' & desc & '">' & label & '</a>'

I1m guessing the mixing of the ' and " characters is messing it up.

How do I fix this?

Thanks again for all your help thus far,
Christopher Raymond



Wed, 05 Jan 2005 13:22:59 GMT  
 ANOTHER NEWBIE QUESTION: String Concatenation

Quote:

> I1ve got the following line offending:

>             tag = '<a class="regularLink" href="javascript:SubmitForm(' &
> "'" & (x - 1) & "'" & ', ' & "'" & url & "'" & ')"
> onmouseover="IconMSOver(' & cell_index & ')" onmouseout="IconMSOut(' &
> cell_index & ')" onclick="this.blur()" title="' & desc & '">' & label &
> '</a>'

> I1m guessing the mixing of the ' and " characters is messing it up.

> How do I fix this?

It can get pretty tricky...  

What I did was use a little WSH hosted .vbs test script to work it out.

' sample values for variables used...
'
x = 10
url = "my url"
cell_index = 9
desc = "my desc"
lable = "my label"

' build the tag...
'
tag = "<a " _
 & "class='regularLink' " _
 & "href='javascript:SubmitForm(" & x - 1 & ", """ & url & """)' " _
 & "onmouseover='IconMSOver(" & cell_index & ")' " _
 & "onmouseout='IconMSOut(" & cell_index & ")' "_
 & "onclick='this.blur()' "_
 & "title='" & desc _
 & "'>" & label & "</a>"

' display it to see if it looks right...
'
msgbox tag

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Thu, 06 Jan 2005 01:15:39 GMT  
 ANOTHER NEWBIE QUESTION: String Concatenation
We can also implement the same task using the eval(x) function, evaluates
JScript/VBScript code and executes it, as I answered in another post.

I have attached the sample sinppet (JScript):

function test(a)
{
        alert(a);

Quote:
}

function button2_onclick() {
        var method_name;
        var parm;
        var signature;

        method_name = "test";
        parm = "hello world!";
        signature = method_name + "('" + parm + "')";
        eval(signature);

Quote:
}

Hope it makes sense.

Gary

This posting is provided "AS IS", with no warranties, and confers no
rights. Enjoyed ASP.NET? http://www.asp.net



Fri, 07 Jan 2005 20:24:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. graph unit

2. Newbie concatenation question

3. Newbie Question: Dim A() as String /Dim A as String()

4. Query --> Table

5. alias for access database

6. speech processing and TCP-IP for TP 5.5?

7. Writing keys to disk in TSR

8. Pascal and/or Xbase Cryptography Sources?

9. string concatenation

10. string concatenation

11. string concatenation

12. Fast string concatenation

 

 
Powered by phpBB® Forum Software