473,799 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

set text input value onclick etc

35 New Member
Hi,

Its something stupidly simple but for some reason i cant find a straight forward cross browser solution.

I've got 2 sets of address fields and i want a tick box that when the user clicks it populates the 2nd lot of boxes with the values in the first.

I had it working in I.E ok using the following;

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("inputid2").value=document.getElementById("inputid1").value;
But it doesn't seem to be working in chrome.....im guessing it must need referencing in a different way.

Does anyone have a straight forward cross browser method for setting various input values.

Thanks
Jan 5 '11 #1
4 2895
Dormilich
8,658 Recognized Expert Moderator Expert
do the input fields actually have an id?
Jan 5 '11 #2
ukfusion
35 New Member
I've actually just checked again and its not working at all(any browser)....the input definitely has an id set.

even this document.getEle mentById("fname b").value="test ";
doesnt work....fnameb is the id.

any reason why that wouldnt work?
Jan 5 '11 #3
Dormilich
8,658 Recognized Expert Moderator Expert
I would need to see the page to make a qualified judgement.
Jan 5 '11 #4
Samishii23
246 New Member
If you have Chrome go to the little Wrench icon in the upper-right (Below the minimize / max / close buttons), then go to Tools, then Javascript Console. It'll give you error messages there, and if it helps you great, if not it could help us help you.

Oh and posting your exact code would help too, or link.
Jan 6 '11 #5

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

Similar topics

5
9927
by: JeffFinnan | last post by:
Is there a way to have a text input field equal some variable value so that it changes if that variable changes? It does not have to by dynamic. <INPUT TYPE="TEXT" NAME="hW" size="4" value=some variable> Thanks, Jeff
1
3833
by: Scott Navarre | last post by:
Hello, I have noticed that when using JavaScript to create a page, the sizes of the text input form elements come out bigger than the size I am trying to set them to. I don't know if it matters, but I am using IE6... For example: if I create a text input with a size of "1" using straight HTML, and then type into it, I can see 2 characters at a time. But when I use JavaScript's 'document.write()' function to create the same text...
5
2853
by: Art | last post by:
Hi, I'm using a form text input to display a JavaScript clock. It has no other purpose than that, just show the date and time. What I would like to do now is prevent anything else happening when it's moused over. I was able to remove the cursor using the blur() method, something like this: document.formname.inputname.blur();
2
1637
by: Offm | last post by:
I was trying to make some experiences with javascript , making a div response to a text input but cannot say what am doing bad so if anyone could help with the script, many Thanks the script follows <script type="text/javascript"> function I(form) { if(form.e2.value=="") document.getElementById("dc").innerHTML="something";
18
25007
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin, that IE7 does not seem to offer any way to control the font size of a text input element.
3
1920
by: Todor Vachkov | last post by:
Dear all, here is the code: ----------------------------- <tr>         <td>ohne Anmeldung: </td>         <td><input name="vanm" id="vanm" type="checkbox" onclick="DisableTeilnehmerzahl()"></td> </tr> <tr>
2
17989
by: troberts | last post by:
Hi What I'm trying to achieve is a watermark on a search box (text input). I've got it working fine (it displays an image, onfocus it shows no image) but when the user writes something then clicks somewhere else on the page it goes wrong. It displays the text plus the image (when I wrote the code I didn't think of this). I've tried a few other things but can't figure it out. PS: I use CSS for the watermark (have tried JS). Any solution...
4
2241
by: Andrew Poulos | last post by:
I have a form that looks something like the following: <form"> <div id="pg0"> <!-- more HTML here --> <input type="text" name="f0_0" > </div> <div id="pg1" style="display:none;"> <!-- more HTML here -->
4
7177
by: Aaron Gray | last post by:
The following input checkbox onclick via DOM is not working on IE7, FF, or WebKit, but is working on Opera for some strange reason. http://www.aarongray.org/Test/JavaScript/checkbox.html Here's the code :- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html>
0
1834
by: pazazuzu | last post by:
Hi everyone, I currently have an assignment which I am almost done with but am having problems trying to figure out how to integrate a string function search. I have a text box called $targetstring. My program allows users to input items such as groceries into one text box (item_value) and add an amount to the groceries purchased (amount_value). The program will add the amounts and give a total and will validate the amount_value box for...
0
9541
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
10484
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...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
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,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
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...
1
4141
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
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.