www.webdeveloper.com
Results 1 to 6 of 6

Thread: Need Help With A javascript Code

  1. #1
    Join Date
    Apr 2009
    Posts
    3

    Need Help With A javascript Code

    that takes information from the user and place it upon the page. I found this
    <SCRIPT type="text/javascript">

    /* This script is intended to take information
    from the user and place it upon the page */

    var user_name = prompt ("Write your name in the box below","Write it here");
    document.write("Hello " + user_name + ". Welcome to my page!");

    </SCRIPT>

    but I want it to do this like what is on this page:http://www.smilegodlovesyou.org/GodLovesYou.html

    I am changing wording of course but I want the same effect.


    can some one please help me.

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,434

    Lightbulb Consider this ...

    See if you can use this method.
    Code:
    <html>
    <head>
    <title>Replacement Script</title>
    <SCRIPT type="text/javascript">
    /* 
    This script is intended to take information
    from the user and place it upon the page
    
    From: http://www.webdeveloper.com/forum/showthread.php?t=207666
    */
    
    var user_name = prompt ("Write your name in the box below","Write it here");
    var user_friend = prompt ('Write the name of a friend here','Write it here');
    
    document.write("Hello " + user_name + ". Welcome to my page!<p>");
    
    window.onload = function() {
      var str = document.getElementById('div1').innerHTML;
      var re = /\:USERNAME\:/gim;
      str = str.replace(re,user_name);
      re = /\:FRIEND\:/gim;
      str = str.replace(re,user_friend);
      document.getElementById('div1').innerHTML = str;
    }
    </SCRIPT> 
    </head>
    <body>
    <form>
    
    <div id="div1">
    <span style="font-size:20px">:USERNAME:</span>, how are you today?
    <p>
    It is nice to meet someone named <span style="color:red">:USERNAME:</span>!
    <p>
    I think I can count on one hand the number of people I know named :USERNAME:.
    <p>
    I believe both <span style="font-size:2em;color:green">:USERNAME: and :FRIEND:</span> are friends!!!
    
    </div>
    </form>
    </body>
    </html>

  3. #3
    Join Date
    Apr 2009
    Posts
    3

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,434
    You're most welcome.
    Glad I could help.
    Good Luck!

  5. #5
    Join Date
    Apr 2009
    Posts
    3
    Can you tell me please what's wrong with my script?

    <html>
    <head>
    <P style="TEXT-ALIGN: justify; LINE-HEIGHT: 27pt; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="COLOR: black; FONT-SIZE: 24pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><FONT face=Calibri><html>
    <SCRIPT type="text/javascript">
    /*
    This script is intended to take information from the user and place it upon the page

    From: http://www.webdeveloper.com/forum/sh...d.php?t=207666
    */

    var user_name = prompt ("Write your name in the box below","Write it here");

    document.write("Personalized Prayer for Healing of Cancer for " + user_name + ". <p>");

    window.onload = function() {
    var str = document.getElementById('div1').innerHTML;
    var re = /\:USERNAME\:/gim;
    str = str.replace(re,user_name);
    document.getElementById('div1').innerHTML = str;
    }
    </SCRIPT>
    <P style="TEXT-ALIGN: justify; LINE-HEIGHT: 20pt; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="COLOR: black; FONT-SIZE: 14pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><FONT face=Calibri><html>

    Heavenly Father YOU are the great physician who promised that YOU will place no disease upon us. You are the Giver of Life. You are the God Who forgives all our iniquities; who heals all our diseases; Who redeems our life from destruction; who crowns us with lovingkindness and tender mercies; Who satisfies our mouth with good things; so that our youth is renewed like the eagle's. You are The Healer. You are The Deliverer. You are The Waymaker. You are The Miracle Worker. You said in Isaiah 53:5 that sent Son Jesus was wounded for our transgressions and iniquities and the chastisement of our peace was upon Jesus and with His stripes we are healed.
    <BR><BR>

    Father I praise You for the gift of Your Son Jesus Christ! Thank You for making available <span style=color:red>:USERNAME:</span> everything needed for life and godliness through the knowledge of Jesus Christ and redeeming <span style=color:red>:USERNAME:</span> from sin and all of its effects and from the power of darkness. Father You said that You show Yourself strong on behalf of those whose heart is loyal to You. Father I know - everything is done by You at the appointed time. I ask You to show Yourself strong on behalf of <span style=color:red>:USERNAME:</span>. Father <span style=color:red>:USERNAME:</span> desires to trust and believe in all that Christ has done at the Cross. Help <span style=color:red>:USERNAME:</span> in every area where faith is week.
    <BR><BR>

    In that name of Jesus Christ Satan I remind you that The Lord God has rebuked you and disarmed all evil principalities and powers and destroyed all your works. You are a thief who brings disease to steal, kill and destroy. In the name of Jesus Christ, I bind every evil spirit sent to destroy <span style=color:red>:USERNAME:</span>’s destiny. I loose you from <span style=color:red>:USERNAME:</span>’s life and destiny. I cancel every evil plan made against <span style=color:red>:USERNAME:</span>’s life and call forth God's plans for <span style=color:red>:USERNAME:</span>’s life. God's word says that God has plans for good and not evil for me and I claim those plans now.
    <BR><BR>

    I command every ungodly entrance that has been opened in <span style=color:red>:USERNAME:</span>’s life to be closed and destroyed in the name of Jesus Christ. I declare that Jesus is Lord over <span style=color:red>:USERNAME:</span>’s life. <span style=color:red>:USERNAME:</span>’s does not serve you or this sickness.. You cannot stay in <span style=color:red>:USERNAME:</span>’s body or have any further effect or hindrance in <span style=color:red>:USERNAME:</span>’s body or life in any manner. I speak death to all cancer cells and command cancer, tumors and every abnormality in <span style=color:red>:USERNAME:</span>’s body and never enter it again. I forbid you from lingering or causing mishap as you come out!
    <BR><BR>

    Father I ask for a creative miracle in <span style=color:red>:USERNAME:</span>’s body in Jesus’ name. Let every area of <span style=color:red>:USERNAME:</span>’s body affected by the cancer be renewed.

    <BR><BR>
    I speak life and restoration to <span style=color:red>:USERNAME:</span>’s body. BODY in the name of Jesus Christ BE HEALED! Recover from the evil that has beset you. Function according to the restoration that has been done at the Cross by the Blood of Jesus Christ!
    <BR><BR>

    Thank you Father for <span style=color:red>:USERNAME:</span>’s complete healing in mind, soul and body. Satisfy <span style=color:red>:USERNAME:</span> with long life according to Your promise in Psalm 91.

    I pray Father for <span style=color:red>:USERNAME:</span>’s family and friends that their faith in Your power fail not. I ask for an abundance of strength for <span style=color:red>:USERNAME:</span>’s and for them. Set a guard over my mouth and the mouths of all who come in contact with <span style=color:red>:USERNAME:</span>’s that they will not speak against the grace and the blessing You have placed in my life. Let no words of doubt and unbelief come out of the mouth of anyone who comes in contact with me. I ask You to replace any doubt in our heart with the Truth of Your Word.
    <BR><BR>

    I ask You to equip <span style=color:red>:USERNAME:</span> to spread the Truth of who You are and declare Your Life giving Power so that all those You Send to <span style=color:red>:USERNAME:</span>’s may come to the knowledge and understanding of Jesus Christ and be saved and healed.
    <BR><BR>
    In Jesus’ mighty name I pray. Amen, Amen and Amen.
    </form>

  6. #6
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    1,031
    There wasn't really anything wrong with the script, more so the HTML. I guess the first and most obvious reason why it doesn't seem like it works is because the script was designed to replace all of the :USERNAME: text inside of a div with the id 'div1'. So you needed to add an element on the page with an id of 'div1' for anything to actually happen.

    In general though, the HTML was pretty bad. I almost get the feeling you were using some sort of WYSIWYG editor to try and build the page. There are a number of missing tags (ie, some tags were opened but never closed, others had closing tags but no opening tags). There was also no closing <head> tag, and no opening <body> tag. Content can only be in the <body>, not the <head> so this would also cause problems. I removed your <font> tags as those are now deprecated and should not be used. And the styling was a bit confusing, so you can always take some time to style it however you want later.

    HTML Code:
    <!doctype html>
    <html>
    <head>
    	<style>
    		.MsoNormal {
    			text-align: justify;
    			line-height: 20pt;
    			margin: 0;
    		}
    		.spanText {
    			color: #000;
    			font-size: 14pt;
    			font-family: 'Times New Roman', Calibri, minor-latin;
    		}
    	</style>
    </head>
    <body>
    <div id="div1" class="MsoNormal">
    <script>
    	/*
    	This script is intended to take information from the user and place it upon the page
    	From: http://www.webdeveloper.com/forum/sh...d.php?t=207666
    	*/
    
    	var user_name = prompt("Write your name in the box below", "Write it here");
    	document.write("Personalized Prayer for Healing of Cancer for " + user_name + ".<br><br>");
    
    	window.onload = function() {
    		console.log(user_name);
    		var str = document.getElementById('div1').innerHTML;
    		var re = /\:USERNAME\:/gim;
    		str = str.replace(re, '<span style="color: #F00;">'+user_name+'</span>');
    		document.getElementById('div1').innerHTML = str;
    	}
    </script>
    
    
    Heavenly Father YOU are the great physician who promised that YOU will place no disease upon us. You are the Giver of Life. You are the God Who forgives all our iniquities; who heals all our diseases; Who redeems our life from destruction; who crowns us with lovingkindness and tender mercies; Who satisfies our mouth with good things; so that our youth is renewed like the eagle's. You are The Healer. You are The Deliverer. You are The Waymaker. You are The Miracle Worker. You said in Isaiah 53:5 that sent Son Jesus was wounded for our transgressions and iniquities and the chastisement of our peace was upon Jesus and with His stripes we are healed.
    
    <br>
    <br>
    
    Father I praise You for the gift of Your Son Jesus Christ! Thank You for making available :USERNAME: everything needed for life and godliness through the knowledge of Jesus Christ and redeeming :USERNAME: from sin and all of its effects and from the power of darkness. Father You said that You show Yourself strong on behalf of those whose heart is loyal to You. Father I know - everything is done by You at the appointed time. I ask You to show Yourself strong on behalf of :USERNAME:. Father :USERNAME: desires to trust and believe in all that Christ has done at the Cross. Help :USERNAME: in every area where faith is week.
    
    <br>
    <br>
    
    In that name of Jesus Christ Satan I remind you that The Lord God has rebuked you and disarmed all evil principalities and powers and destroyed all your works. You are a thief who brings disease to steal, kill and destroy. In the name of Jesus Christ, I bind every evil spirit sent to destroy :USERNAME:'s destiny. I loose you from :USERNAME:'s life and destiny. I cancel every evil plan made against :USERNAME:'s life and call forth God's plans for :USERNAME:'s life. God's word says that God has plans for good and not evil for me and I claim those plans now.
    
    <br>
    <br>
    
    I command every ungodly entrance that has been opened in :USERNAME:'s life to be closed and destroyed in the name of Jesus Christ. I declare that Jesus is Lord over :USERNAME:'s life. :USERNAME:'s does not serve you or this sickness.. You cannot stay in :USERNAME:'s body or have any further effect or hindrance in :USERNAME:'s body or life in any manner. I speak death to all cancer cells and command cancer, tumors and every abnormality in :USERNAME:'s body and never enter it again. I forbid you from lingering or causing mishap as you come out!
    
    <br>
    <br>
    
    Father I ask for a creative miracle in :USERNAME:'s body in Jesus' name. Let every area of :USERNAME:'s body affected by the cancer be renewed.
    
    <br>
    <br>
    
    I speak life and restoration to :USERNAME:'s body. BODY in the name of Jesus Christ BE HEALED! Recover from the evil that has beset you. Function according to the restoration that has been done at the Cross by the Blood of Jesus Christ!
    
    <br>
    <br>
    
    Thank you Father for :USERNAME:'s complete healing in mind, soul and body. Satisfy :USERNAME: with long life according to Your promise in Psalm 91.
    
    <br>
    <br>
    
    I pray Father for :USERNAME:'s family and friends that their faith in Your power fail not. I ask for an abundance of strength for :USERNAME:'s and for them. Set a guard over my mouth and the mouths of all who come in contact with :USERNAME:'s that they will not speak against the grace and the blessing You have placed in my life. Let no words of doubt and unbelief come out of the mouth of anyone who comes in contact with me. I ask You to replace any doubt in our heart with the Truth of Your Word.
    
    <br>
    <br>
    
    I ask You to equip :USERNAME: to spread the Truth of who You are and declare Your Life giving Power so that all those You Send to :USERNAME:'s may come to the knowledge and understanding of Jesus Christ and be saved and healed.
    
    <br>
    <br>
    
    In Jesus' mighty name I pray. Amen, Amen and Amen.
    </div>
    
    </body>
    </html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles