Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

javascript question

Asked Modified Viewed 1,411 times
J
Jebajseti
J
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 10 threads in the forums
  • Started this discussions
asked
Junior Member

Hi,

i am using marcus mg announcement panel, which is not for public release so i will not include all files here for that reason.
I have a question about javascript because didnt find on google nothing that would make it simple for me.

part of code


      echo "<script type='text/javascript'>
            $(document).ready(function(){
               $('#announce_text".$data['announcement_id']."').fadeIn('slow', function(){
                     $('#announce_textboxclose".$data['announcement_id']."').fadeIn('slow');
               });
            });
            $(function() {
               $('#announce_textboxclose".$data['announcement_id']."').click(function() {
                  $('#announce_textboxclose".$data['announcement_id']."').fadeOut('slow', function(){
                     $('#announce_text".$data['announcement_id']."').fadeOut('slow');
                  });
               });
            });
         </script>";
         }
      }
   }
}
?>


#announce_text".$data['announcement_id']."' is triggered when site loads, now i would like to change that and make it by click. How to do that, how should link look like?

Regards
0 replies

3 posts

A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

First, create a Button or whatever on which clicking it will be done. Give some attribute id to the button, say, id='mytrigger', then use this Code :
Don't forget to replace ID_of_the_Button_field with the ID you defined, i.e, mytrigger !
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<script type='text/javascript'>
$(document).ready(function(){

$("#ID_of_the_Button_field"wink.click(function(e){

$('#announce_text".$data['announcement_id']."'wink.fadeIn('slow', function(){
$('#announce_textboxclose".$data['announcement_id']."'wink.fadeIn('slow'wink;
});
});

});

$(function() {
$('#announce_textboxclose".$data['announcement_id']."'wink.click(function() {
$('#announce_textboxclose".$data['announcement_id']."'wink.fadeOut('slow', function(){
$('#announce_text".$data['announcement_id']."'wink.fadeOut('slow'wink;
});
});
});
</script>";[/syntaxhighlighter]

Merged on Jul 18 2011 at 12:09:28:
[ Moved to Panels and Infusions ]
0 replies
J
Jebajseti
J
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 10 threads in the forums
  • Started this discussions
answered
Junior Member

ok only 1 question more about javascript launch on click
example of $("#ID_of_the_Button_field").click(function(e){

how can i make to launch function
myfunction() {
//content
}

instead of id like on something this? $(myfunction()).click(function(e)
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Just simply add the onclick attribute, example :-
[syntaxhighlighter brush=html,first-line=1,highlight=0,collapse=false,html-script=false]<input type='button' value='Fire the Function' onclick='myfunction()' />[/syntaxhighlighter]
0 replies

Category Forum

Panels and Infusions

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
J
J
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 10 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet