Results 1 to 2 of 2

Thread: Integrating JQuery and Javascript in the same function?

  1. #1
    Caution is offline New Member: Posts Will Be Moderated
    Join Date
    Mar 2011
    Posts
    2

    Integrating JQuery and Javascript in the same function?

    Hello,

    I'm attempting to create a system that will allow, when you hover over something, to change information in one area, and then use the fade functions of JQuery at the same time. The function affected is here:

    Code:
    function WhatsNewCaption(linkNumber, parameter) {
    	if(parameter>0) {
    		document.getElementById("WhatsNewCaption").innerHTML=document.getElementById("JavaScriptWhatsNewPicture"+linkNumber).alt; 
    		var genericCounter=1;
    		while(genericCounter) {
    			if(document.getElementById("JavaScriptWhatsNewPicture"+genericCounter)) {
    				$("#JavaScriptWhatsNewPicture"+genericCounter).fadeOut(1,0.3);
    				genericCounter++;} 
    			else {
    				break; } }
    		$("JavaScriptWhatsNewPicture"+linkNumber).fadeIn(50,1.0); }
    	else {
    		document.getElementById("WhatsNewCaption").innerHTML=""; } }
    The issue is when this function is called, it simply does nothing. This type of integration has worked once before and I didn't change the syntax, but I question if it really should have ever worked before then... anyways, help?

  2. #2
    Caution is offline New Member: Posts Will Be Moderated
    Join Date
    Mar 2011
    Posts
    2
    Update to this situation:

    Did some more research, modified the code to:

    Code:
    function WhatsNewCaption(linkNumber, parameter) {
    	if(parameter>0) {
    		document.getElementById("WhatsNewCaption").innerHTML=document.getElementById("JavaScriptWhatsNewPicture"+linkNumber).alt; 
    		var genericCounter=1;
    		while(genericCounter) {
    			if(document.getElementById("JavaScriptWhatsNewPicture"+genericCounter)) {
    				$("#JavaScriptWhatsNewPicture"+genericCounter).fadeTo(700,0.3);
    				genericCounter++;} 
    			else {
    				break; } } 
    		 $("JavaScriptWhatsNewPicture"+linkNumber).fadeTo(700,1.0); } 
    	else {
    		document.getElementById("WhatsNewCaption").innerHTML=""; 
    		 $("JavaScriptWhatsNewPicture2").fadeTo(700,1.0); } }
    Now, the picture being chosen when parameter =1 (mouseover) will cause all the pictures to fade out (correct), but the one hovering will not become clear. Likewise, when parameter is 0 (mouseout), all the pictures stay faded, but the 2nd picture should always become more clear in this situation. Unsure what to do here - help?

Similar Threads

  1. php and javascript function
    By philmetz in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 02 Jan 2011, 05:02 AM
  2. Javascript function call in a php function problem
    By iuliser in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 15 Nov 2010, 07:10 AM
  3. javascript calling function
    By kennedysee in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 22 Jan 2010, 01:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •