views:

59

answers:

3

I have the following markup which I do not have direct access to...

<a href="javascript:void(0);" onclick="window.open('/BulkDiscounts.asp?ProductID=318&ProductCode=' + escape('LB30X40ES') + '&Orig_Price=22.95', 'Discounts', 'scrollbars,status,resizable,width=330,height=300');"><iimg src="/v/vspfiles/templates/100/images/buttons/btn_quantitydiscounts.gif" border="0" align="absmiddle"></a>

I need to "rewrite" the above as follows...

A few things to point out is that the title is coming from a variable escape(global_Current_ProductCode) variable=productcode

The height, width, price and product id used in the second markup must be from the first markup. Note that these change depending on the product page loaded. These are not constants.

I would guess the first thing to do was to add the thickbox class. Then I am lost as to what to do next.

Basically I need to open up an thickbox iframe with the modified markup.

A: 

the second part was as follows...

<aa href="/BulkDiscounts.asp?ProductID=318&ProductCode=LB30X40ES&Orig_Price=22.95&keepThis=true&TB_iframe=true&height=300&width=330"

title="LB30X40ES Laundry Bags" class="thickbox"> img border="0" align="absmiddle" src="/v/vspfiles/templates/100/images/buttons/btn_quantitydiscounts.gif">

sorry about all the edits and code mods <aa and the img> but it won't let me post it another way until i earn some more rep
+1  A: 

Register and ask again in a more parsable way.

unomi
Hi guy who down voted me, the question is spread over a garbled question section and a garbled answer section. I don't have the rep to fix it and seemingly you don't either, so don't you think that the best thing would have been to resubmit the q so that more people could actually use it for something?
unomi
I did not vote you down, but you are correct in what you say. I had to post it that way because the site would not let me do it the correct way, I will repost it, thx
Though I didn't downvote you, this should be posted as a comment to the original question (but you're right this question is a mess).
Marcel Korpel
A: 

Untested - should get you close:

var re = /.*?\(('.*?'),.*?'(.*?)'.*(width=\d*).*(height=\d*).*/;
var match =  $("a").attr("onclick").match(re);
eval("var url = " + match[1]);
$('a').unbind('click').click(function() {
   TB_show(match[2], url + "&keepThis=true&TB_iframe=true&" + match[3] + "&" + match[4]);
});
Scott Evernden
i am testing it now
The thickbox does not open just the popup window as beforeI see you are trying to open the window directly with TB_show by unbinding the click function but for some reason its not working.If I could just get the markup changed to the second code posted then it would work.