views:

236

answers:

1

hi,

ı want to send href value. but its not working.

function display () {
$.fancybox({
'href': 'index.php',
'width'    : '75%',
'height'   : '75%',
'autoScale'   : false,
'transitionIn'  : 'none',
'transitionOut'  : 'none',
'type'    : 'iframe'

 });

}

ı tryed this :

function display (who) {
$.fancybox({
'href': 'index.php'+who,
'width'    : '75%',
'height'   : '75%',
'autoScale'   : false,
'transitionIn'  : 'none',
'transitionOut'  : 'none',
'type'    : 'iframe'

 });
}

<a onclick="javascript:display("?id=11");" href="#"  >create</a>

this onclick event inside the innerhtml so its not working with ' slash

why

A: 

You can use single quotes for this, like this:

<a onclick="javascript:display('?id=11');" href="#">create</a>

However, a better approach would be a click handler, if you gave your anchor a class, like this:

<a class="create" href="#">create</a>

You could use hook it up like this:

$(".create").click(function() {
  display("?id=11");
});
Nick Craver
this onclick event inside the innerhtml so its not working with ' slash
samuel saul
@samuel - I don't follow you there, can you phrase it differently? I would use the second method in my answer, but if you must you can escape a slash, like this `\'` or `\"`, then you can use quotes inside of a string.
Nick Craver
thank you man yes its working million thanks
samuel saul