SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Aug 19, 2008, 00:09 #1
- Join Date
- Aug 2008
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Javascript Code To String variable
Whether there is a utility for transformation Javascript code in a line variable?
example:
Code:var a = "<script type=\"text/javascript\">function OnChangeRiskBrand() { UpdateLink_RiskBrand() } </script>"
-
Aug 19, 2008, 00:21 #2
- Join Date
- Aug 2008
- Posts
- 19
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Why do you need script tag?
Code:var a = function () {UpdateLink_RiskBrand();} // is inline function only.
-
Aug 19, 2008, 00:31 #3
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
Hi kodermax, welcome to the forums,
What you have shown is assigning the code string to a variable.
What are you trying to do with it?Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Aug 19, 2008, 00:41 #4
- Join Date
- Aug 2008
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Aug 19, 2008, 02:35 #5
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
I'm a bit of an OOP newbie, but you should be able to pass the string to an object. It would help to see the context. What code to you have so far.
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
Bookmarks