473,770 Members | 4,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

code doesn't work!!

13 New Member
i wanted to print name which is given by user dynamically.
that is "myMother.first name".but it does not work any more.please help me solve this.
Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <p>heyy</p>
  3. First name:<input type="text" id="fname" onclick="callme()">
  4. <script type="text/javascript">
  5. <!--
  6.  
  7.     function person(firstname)
  8.       {
  9.           this.firstname=firstname;
  10.  
  11.       }
  12.  
  13.     function callme()
  14.     {
  15.         var n=document.getElementById("fname").value;
  16.         myMother=new person(n);
  17.     }
  18.      var d=document.getElementById("demo");
  19.      document.write("First name is:" +d.innerHTML=myMother.firstname);
  20. //-->
  21. </script>
  22. <p id="demo"></p>
  23. </body>
  24.  
Jul 21 '13 #1
7 1453
Dormilich
8,658 Recognized Expert Moderator Expert
document.write( ) is deleting your page (when used after the initial page load), including all scripts.
Jul 21 '13 #2
dhaval1993
13 New Member
sorry,i cant get it what you trying to say.please elaborat.
Thank you.
Jul 21 '13 #3
dhaval1993
13 New Member
okay i just edit my code.In that i remove document.write( ).
but still it has no effect on output!!!
Jul 21 '13 #4
Dormilich
8,658 Recognized Expert Moderator Expert
sorry,i cant get it what you trying to say
I said that document.write( ) erases your page (in the browser, not on the server, of course), it’s as simple as that.

but still it has no effect on output!!!
post the new code.
Jul 21 '13 #5
dhaval1993
13 New Member
Expand|Select|Wrap|Line Numbers
  1. <p>heyy</p>
  2. First name:<input type="text" id="fname" onclick="callme()">
  3. <script type="text/javascript">
  4.  
  5.  
  6.     function person(firstname)
  7.       {
  8.           this.firstname=firstname;
  9.  
  10.       }
  11.  
  12.     function callme()
  13.     {
  14.         var n=document.getElementById("fname").value;
  15.         myMother=new person(n);
  16.     }
  17.      var d=document.getElementById("demo");
  18.      d.innerHTML=myMother.firstname;
  19.  
  20. </script>
  21. <p id="demo"></p>
  22. </body>
  23.  
Jul 21 '13 #6
dhaval1993
13 New Member
function person(firstnam e)
this is called or not!
as there is no output on my browser!
Jul 21 '13 #7
Dormilich
8,658 Recognized Expert Moderator Expert
anything in the Error Console?
Jul 21 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1682
by: sachin bond | last post by:
The following code(in c++) is supposed to divide a file into 'n' different files. suppose i'm having a file called "input.zip". The execution of the following code should divide "input.zip" into 'n'(user specified) different files. However the code currently..though makes 'n' different files... the divided contents are stored only in the first of the 'n' files.
3
2097
by: sachin bond | last post by:
this code does not work.... plz help...... void breaker() {
1
1448
by: chris | last post by:
hi i am trying to make a vb.net control using Imports System.Web Dim email As New System.Web.Mail.MailMessage but it gives me the error Type 'System.Web.Mail.MailMessage' is not defined. why is that however i am able to send messages using asp.net's createobject ("...")
2
2098
by: Rhys.Mataira | last post by:
My code will not show up anything at all on the screen can someone guide me why this would be? <?php $pagetitle="Login"; If (!$_POST) or (!$_POST) { echo" <head></head> <style type=\”text/css\”> <!--
4
2215
by: raaman rai | last post by:
Hi guys, i installed WAMP Server 2 yesterday but i waz surprised to see that the following code doesnt work. Today is <? print strftime("%m/%d/%Y"); ?> The output is just: Today is If i use the proper php tag i.e <?php ?> it works but what i feel is that php5 files do not have the <?php ?> style. So, whats the problem???
1
1599
by: Dany13 | last post by:
hi all. i using some text box for input value and some localvarible for passing this data to dataset . give instance for correct row of dataset and data in data table . use one gird view for showing curent data in dataset . in end i am calling update metod to insert data in sql database but this metod doesnt work correctly. at all doesnt work. but givenot any error . fill data from my database (work propebly) ...
9
1701
by: AGP | last post by:
I've been scratching my head for weeks to understand why some code doesnt work for me. here is what i have: dim sVal as string = "13.2401516" dim x as double x = sVal debug.writeline ( x)
2
2211
Thew
by: Thew | last post by:
<script language="javascript" type="text/javascript"> function spoilershow(){ document.getElementById("spoiler").style.visibility='visible'; document.getElementById("show").value='close'; document.getElementById("show").onclick='spoilerhide()'; } function spoilerhide(){
0
1400
by: xteaun | last post by:
Hi! I am trying to use the following code in a little VB.Net project and I just cant get it to work. I get an error that says the "adressof"-command isnt using the right delegate type and some functions seem to be missin return commands?!? Could someone please have a look at this and maybe change it, so it works in VB.Net? Thank you :) Christian ==== Attribute VB_Name = "Module_PaceMaker"
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.