basically I get information from an external xml document like this
Expand|Select|Wrap|Line Numbers
- function run(file) {
- t = file.getElementsByTagName("category");
- for(i=0; i<t.length; i++) {
- element = file.getElementsByTagName("category")[i].childNodes[0].nodeValue;
- theMenu += "<a href='javascript:open(f, "+
- element+")'>"+
- element+
- "</a><br>";
- }
- }
to test this i create this function:
Expand|Select|Wrap|Line Numbers
- function open(msg) {
- alert(msg);
- }
Expand|Select|Wrap|Line Numbers
- Error: 'Something' is undefined
I figured that a way to solve this is to tell the machine that whatever is assigned to element should be considered a string. But I don't know how to deal with the syntax of 3 quotes in each other because I would essentially need something like this:
Expand|Select|Wrap|Line Numbers
- theMenu += "<a href="javascript:open(f, ""+
- element+"")">"+
- element+
- "</a><br>";
Is there another way around this error? Sorry for the length of this... any help appriciated.