• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5384
  • Last Modified:

javascript hide submit button on click and show loading image instead

i'm tryin to get this code to work but i'm having no luck, i want it to hide the submit button on click and show this loading image, any help is appreciated, thanks

      <td colspan = "10"><input type = "button" style = "visibility:visible;" value = "Generate Report" onclick = "this.style.visibility:'hidden', loading.style.visibility:'visible'">
      <img src="../../images/img-loading.gif" alt="" border="0" name = "loading" style = "visibility:hidden;"></td>
0
LTY83
Asked:
LTY83
1 Solution
 
cLFlaVACommented:

<td colspan="10">
<input
  type = "button"
  value = "Generate Report"
  onclick = "this.style.display = 'none'; loading.style.display = '';">

<img
  src="../../images/img-loading.gif"
  alt=""
  border="0"
  name = "loading"
  id = "loading"
  style = "display: none;">
</td>
0
 
cLFlaVACommented:
OR

<td colspan="10">
<input
  type = "button"
  value = "Generate Report"
  onclick = "this.style.visibility = 'hidden'; loading.style.visibility = 'visible';">

<img
  src="../../images/img-loading.gif"
  alt=""
  border="0"
  name = "loading"
  id = "loading"
  style = "visibility: hidden;">
</td>
0
 
LTY83Author Commented:
u solve my problems everytime, thanks man
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
GwynforWebCommented:
<input type="button" style="visibility:visible;" value="Generate Report"
onclick="this.style.visibility='hidden'; loading.style.visibility='visible'">
<img src="http://www.experts-exchange.com/images/pe/1088274.jpg" alt border="0" name="loading"
style="visibility:hidden;">
0
 
cLFlaVACommented:
no prob :)
0
 
KMETAVZERCommented:
Hi,
i'm new here.
I have this problem:
Script working fine, but loading.gif into my module don't want rotate.
(my loading.gif is an animated gif !)
How i can solve this problem?
Thanks for replies.


<?php

// no direct access
defined('_JEXEC') or die('Restricted access');

$label		= $params->get( 'label', '' );
$buttontext		= $params->get( 'buttontext', '' );
$resulttext		= $params->get( 'resulttext', '' );
$checkall		= $params->get( 'checkall', '' );
$pretext		= $params->get( 'pretext', '' );
$forwardurl		= $params->get( 'forwardurl', '' );
$s5_domain1		= $params->get( 's5_domain1', '' );
$s5_break1		= $params->get( 's5_break1', '' );
$s5_domain2		= $params->get( 's5_domain2', '' );
$s5_break2		= $params->get( 's5_break2', '' );
$s5_domain3		= $params->get( 's5_domain3', '' );
$s5_break3		= $params->get( 's5_break3', '' );
$s5_domain4		= $params->get( 's5_domain4', '' );
$s5_break4		= $params->get( 's5_break4', '' );
$s5_domain5		= $params->get( 's5_domain5', '' );
$s5_break5		= $params->get( 's5_break5', '' );
$s5_domain6		= $params->get( 's5_domain6', '' );
$s5_break6		= $params->get( 's5_break6', '' );
$s5_domain7		= $params->get( 's5_domain7', '' );
$s5_break7		= $params->get( 's5_break7', '' );
$s5_domain8		= $params->get( 's5_domain8', '' );
$s5_break8		= $params->get( 's5_break8', '' );
$s5_domain9		= $params->get( 's5_domain9', '' );
$s5_break9		= $params->get( 's5_break9', '' );
$s5_domain10	= $params->get( 's5_domain10', '' );
$s5_break10		= $params->get( 's5_break10', '' );
$s5_domain11	= $params->get( 's5_domain11', '' );
$s5_break11		= $params->get( 's5_break11', '' );
$s5_domain12	= $params->get( 's5_domain12', '' );
$s5_break12		= $params->get( 's5_break12', '' );
$s5_domain13	= $params->get( 's5_domain13', '' );
$s5_break13		= $params->get( 's5_break13', '' );
$s5_domain14	= $params->get( 's5_domain14', '' );
$s5_break14		= $params->get( 's5_break14', '' );
$s5_domain15	= $params->get( 's5_domain15', '' );
$s5_break15		= $params->get( 's5_break15', '' );
$s5_domain16	= $params->get( 's5_domain16', '' );
$s5_domain17	= $params->get( 's5_domain17', '' );

?>

<?php if ($pretext != "") { ?>
<div style="margin-bottom:8px">
<?php echo $pretext ?>
</div>
<?php } ?>

<?php

    function checkDomain($domain,$server,$findText){
        // Open a socket connection to the whois server
        $con = fsockopen($server, 43);
        if (!$con) return false;
        
        // Send the requested doman name
        fputs($con, $domain."\r\n");
        
        // Read and store the server response
        $response = ' :';
        while(!feof($con)) {
            $response .= fgets($con,128); 
        }
        
        // Close the connection
        fclose($con);
        
        // Check the response stream whether the domain is available
		// echo $response;
        if (strpos($response, $findText)){
		
            return true;
        }
        else {
            return false;   
        }
    }
    
    function showDomainResult($domain,$server,$findText){
	
       if (checkDomain($domain,$server,$findText)){
          echo "<div style='margin-bottom:4px;'><span style='color:black;'>$domain  </span><span style='color:green; font-weight:bold;'>Available</span></div>";
       }
       else echo "<div style='margin-bottom:4px;'><span style='color:black;'>$domain  </span><span style='color:red; font-weight:bold;'>Taken</span></div>";
    }
	
?>

    <div style="width: 180px; background-color:transparent;">
      <form action="<?php echo $forwardurl ?>" method="post" name="domain" id="domain">
      <table border="0" align="center" style="background-color: transparent;">
      <tr>
      <td align="center" colspan="3">
	  <span style="font-weight:bold">
        <?php echo $label ?> :
	  </span>
		<div style="margin-top:8px; margin-bottom:8px;">
				<input class="text" name="domainname" type="text" />
		</div>
	  

		<div style="margin-bottom:8px">	
                <input type="checkbox" style="background-color:transparent;" name="all" checked="checked"/> <?php echo $checkall ?>
		</div>
	  </td>
	  </tr>
      <tr>
      <td colspan="1" style="width: 58px; padding-left:16px;">
      <div>		
		<?php if ($s5_domain1 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="com"/> .com

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain2 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="net"/> .net

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain3 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="info"/> .info

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain4 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="org"/> .org

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain5 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="biz"/> .biz

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain16 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="it"/> .it

				<div style="height:8px;"></div>

		<?php } ?>		
	  </div>		
	  </td>
      <td colspan="1" style="width: 62px; padding-left:4px;">
	  <div>      		
		<?php if ($s5_domain6 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="couk"/> .co.uk

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain7 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="name"/> .name

				<div style="height:8px;"></div>

		<?php } ?>

		<?php if ($s5_domain13 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="mobi"/> .mobi

				<div style="height:8px;"></div>

		<?php } ?>

		<?php if ($s5_domain12 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="edu"/> .edu

				<div style="height:8px;"></div>

		<?php } ?>		
		
		<?php if ($s5_domain10 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="tv"/> .tv

				<div style="height:8px;"></div>

		<?php } ?>
				
	  </div>		
	  </td>
      <td colspan="1" style="width: 58px; padding-left:2px;">		
	  <div>		
		<?php if ($s5_domain11 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="eu"/> .eu

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain9 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="us"/> .us

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain8 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="cc"/> .cc

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain14 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="nl"/> .nl

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain15 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="ca"/> .ca

				<div style="height:8px;"></div>

		<?php } ?>
		
		<?php if ($s5_domain17 == "yes") { ?>	
                <input type="checkbox" style="background-color:transparent;" name="si"/> .si

				<div style="height:8px;"></div>

		<?php } ?>		
		</div>
	    </td>
		</tr>
		<tr>
        <td colspan="3" align="center">				
		    <div>
				<input class="button" type="submit" onclick = "this.style.visibility = 'hidden'; loading.style.visibility = 'visible';" name="submitBtn" value="<?php echo $buttontext ?>"/>
				<img src="/images/loading.gif" alt="" border="0" name = "loading" id = "loading" style = "visibility: hidden;" />
			</div>	
	    </td>
		</tr>
	    </table>
      </form>

	  
<?php    
    if (isset($_POST['submitBtn'])){
        $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
        $d_all      = (isset($_POST['all'])) ? 'all' : '';   
		
		if ($s5_domain1 == "yes") {
        $d_com      = (isset($_POST['com'])) ? 'com' : ''; 
		}	    
		
		if ($s5_domain2 == "yes") {
        $d_net      = (isset($_POST['net'])) ? 'net' : ''; 
		}	
		
		if ($s5_domain3 == "yes") {
        $d_info      = (isset($_POST['info'])) ? 'info' : ''; 
		}	   
		
		if ($s5_domain4 == "yes") {
        $d_org      = (isset($_POST['org'])) ? 'org' : ''; 
		}	
		
		if ($s5_domain5 == "yes") {
        $d_biz      = (isset($_POST['biz'])) ? 'biz' : ''; 
		}
		
		if ($s5_domain6 == "yes") {
        $d_couk      = (isset($_POST['couk'])) ? 'couk' : ''; 
		}
		
		if ($s5_domain7 == "yes") {
        $d_name      = (isset($_POST['name'])) ? 'name' : ''; 
		}
		
		if ($s5_domain8 == "yes") {
        $d_cc      = (isset($_POST['cc'])) ? 'cc' : ''; 
		}
		
		if ($s5_domain9 == "yes") {
        $d_us      = (isset($_POST['us'])) ? 'us' : ''; 
		}
		
		if ($s5_domain10 == "yes") {
        $d_tv      = (isset($_POST['tv'])) ? 'tv' : ''; 
		}
		
		if ($s5_domain11 == "yes") {
        $d_eu      = (isset($_POST['eu'])) ? 'eu' : ''; 
		}
		
		if ($s5_domain12 == "yes") {
        $d_edu      = (isset($_POST['edu'])) ? 'edu' : ''; 
		}
		
		if ($s5_domain13 == "yes") {
        $d_mobi      = (isset($_POST['mobi'])) ? 'mobi' : ''; 
		}
		
		if ($s5_domain14 == "yes") {
        $d_nl      = (isset($_POST['nl'])) ? 'nl' : ''; 
		}
		
		if ($s5_domain15 == "yes") {
        $d_ca      = (isset($_POST['ca'])) ? 'ca' : ''; 
		}
        
 		if ($s5_domain16 == "yes") {
        $d_it      = (isset($_POST['it'])) ? 'it' : ''; 
		}       
        
		if ($s5_domain17 == "yes") {
        $d_si      = (isset($_POST['si'])) ? 'si' : ''; 
		}
		        
        // Check domains only if the base name is big enough
        if (strlen($domainbase)>0){
?>
      <div id="caption" style="margin-top:8px; margin-bottom:8px; font-weight:bold"><?php echo $resulttext ?> :</div>
      <div id="result">

<?php        

			if ($s5_domain1 == "yes") {
            if (($d_com != '') || ($d_all != '') ) showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
			}	
			
			if ($s5_domain2 == "yes") {
            if (($d_net != '') || ($d_all != '') ) showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
			}	
			
			if ($s5_domain3 == "yes") {
            if (($d_info != '') || ($d_all != '') ) showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND');
			}	
			
			if ($s5_domain4 == "yes") {
            if (($d_org != '') || ($d_all != '') ) showDomainResult($domainbase.".org",'whois.publicinterestregistry.net','NOT FOUND');
			}	
			
			if ($s5_domain5 == "yes") {
            if (($d_biz != '') || ($d_all != '') ) showDomainResult($domainbase.".biz",'whois.neulevel.biz','Not found:');
			}	
			
			if ($s5_domain6 == "yes") {
            if (($d_couk != '') || ($d_all != '') ) showDomainResult($domainbase.".co.uk",'whois.nic.uk','No match for');
			}	
			
			if ($s5_domain7 == "yes") {
            if (($d_name != '') || ($d_all != '') ) showDomainResult($domainbase.".name",'whois.nic.name','No match');
			}	
			
			if ($s5_domain8 == "yes") {
            if (($d_cc != '') || ($d_all != '') ) showDomainResult($domainbase.".cc",'whois.nic.cc','No match');
			}	
			
			if ($s5_domain9 == "yes") {
            if (($d_us != '') || ($d_all != '') ) showDomainResult($domainbase.".us",'whois.nic.us','Not found:');
			}
			
			if ($s5_domain10 == "yes") {
            if (($d_tv != '') || ($d_all != '') ) showDomainResult($domainbase.".tv",'whois.nic.tv','No match for');
			}
			
			if ($s5_domain11 == "yes") {
            if (($d_eu != '') || ($d_all != '') ) showDomainResult($domainbase.".eu",'whois.eu','FREE');
			}
			
			if ($s5_domain12 == "yes") {
            if (($d_edu != '') || ($d_all != '') ) showDomainResult($domainbase.".edu",'whois.crsnic.net','No match for');
			}
			
			if ($s5_domain13 == "yes") {
            if (($d_mobi != '') || ($d_all != '') ) showDomainResult($domainbase.".mobi",'whois.dotmobiregistry.net','NOT FOUND');
			}
			
			if ($s5_domain14 == "yes") {
            if (($d_nl != '') || ($d_all != '') ) showDomainResult($domainbase.".nl",'whois.domain-registry.nl','free');
			}
			
			if ($s5_domain15 == "yes") {
            if (($d_ca != '') || ($d_all != '') ) showDomainResult($domainbase.".ca",'whois.cira.ca','AVAIL');
			}

			if ($s5_domain16 == "yes") {
            if (($d_it != '') || ($d_all != '') ) showDomainResult($domainbase.".it",'whois.nic.it','No match for');
			}
			
			if ($s5_domain17 == "yes") {
            if (($d_si != '') || ($d_all != '') ) showDomainResult($domainbase.".si",'whois.arnes.si','No entries found');
			}			

?>

     </div>
<?php            
        }
    }
?>    

    </div>

Open in new window

0
 
KMETAVZERCommented:
Maybe i have to add an interval between each socket connection to the whois server ?

(button is placed on line 245 of attached file)
0
 
KMETAVZERCommented:
Also a squeeze box that cover the page could be a good solution.
Somebody know a good script that can be easly integrated into a joomla's template (into index.php)?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now