Forum Moderators: open
Here is what I'm doing:
document.getElementById('proofBox').innerHTML = '<a href="javascript:loadContent('someFile.php?dh='+document.getElementById('myDIV').offsetHeight+'&dw='+document.getElementById('myDIV').offsetWidth);">Link Text</a>';
Is there some safe way to escape some of those quotes to get this to work?
to see what you're doing, using indentation (aka metrosexual programming [google.com])
It seems that you have a superfluous );
What is &dw?
If you want an HTML ampersand, it ought to be &dw=
try
document.getElementById('proofBox').innerHTML = ''
+'<a href= "javascript:loadContent(\'someFile.php?dh='
+ document.getElementById('myDIV').offsetHeight
+ '&dw='
+ document.getElementById('myDIV').offsetWidth
+ '\'">'
+'Link Text<\/a>';
Ok, the metrosexual programming thing is pretty funny. I had to look it up, I thought I was being insulted! :)
Actually the extra ); was the end of the loadContent( call, so it is needed. I'll give the \ slash a try, thanks for the help.