-
String concatenation - calling a function from a string using variables as parameters
Hi.
I´d like to know...
How could I call a function with variables as arguments from a string?
I´m trying this way:
blogHTML = "<h2><a href='javascript:void(0)' onclick='Blog.getPost("+this.id,Blog._currentBlog+");'>"+this.header+"</a></h2>";
Not working...
Thanks.
-
use \" to quote parameter values within attribs, because unless this.id and Blog._currentBlog are numbers, they need to be quoted strings.
you can also use a template function to make it easier to code, but the nested quotes will be the same on both final outputs.
Last edited by rnd me; 03-02-2013 at 06:31 PM.
-
 Originally Posted by rnd me
use \" to quote parameter values within attribs, because unless this.id and Blog._currentBlog are numbers, they need to be quoted strings.
you can also use a template function to make it easier to code, but the nested quotes will be the same on both final outputs.
Hi.
How could I quote the gray code?
<a href='javascript:void(0)' onclick='Blog.getPost("+this.id+","+ Blog._currentBlog+");return false;' style='text-decoration:none;' title='Post-header-"+this.id+"'>"+this.header+"</a>
Thanks.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks