Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

javascript hide submit button on click and show loading image instead

Posted on 2004-10-26
8
Medium Priority
?
5,213 Views
Last Modified: 2008-01-09
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
Comment
Question by:LTY83
8 Comments
 
LVL 13

Accepted Solution

by:
cLFlaVA earned 2000 total points
ID: 12415403

<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
 
LVL 13

Expert Comment

by:cLFlaVA
ID: 12415420
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
 
LVL 4

Author Comment

by:LTY83
ID: 12415423
u solve my problems everytime, thanks man
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Expert Comment

by:GwynforWeb
ID: 12415427
<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
 
LVL 13

Expert Comment

by:cLFlaVA
ID: 12415428
no prob :)
0
 

Expert Comment

by:KMETAVZER
ID: 33866471
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
 

Expert Comment

by:KMETAVZER
ID: 33866507
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
 

Expert Comment

by:KMETAVZER
ID: 33866561
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question