jason213123 Posted May 23, 2010 Share Posted May 23, 2010 hi, i have many filelds on my site that i want change the value. for example i have: a link: "click here for change" with this code: -> linker (26,'field_name'); that call the javascript function function linker ( id,field_name) { document.field_name.value = id; <- here i want change the value for the name of the field that i have said. now i have try on some ways but i can´t find one that works how can i do that? thanks a lot for your help Quote Link to comment Share on other sites More sharing options...
Ang3l0fDeath Posted May 24, 2010 Share Posted May 24, 2010 You need to give more detail on what you want to do.... yes i know you want to change a link, but how? and do you want to change the link location or the text of the link? And can you give examples of the links you want to change? Also here is a few examples of stuff to look into or change about you function function a_href_update( id, field_name ) { document.getElementById(field_name).value = id; //here i want change the value document.getElementById(field_name).href = new_url; //a href change url location document.getElementById(field_name).value= new_text; //input element value change document.getElementById(field_name).innerHTML= new_text; //a link element change text // I find it confusing you have field_name & id, thats 2 location pointers and you only need 1. // you only need 1 location pointer which generally ID= or Name= or ClassName= // If you do the Name=/ClassName= you still got to go another step to identify location. ID is generally best for a unique ID name. // If you changing lots of links at once do yourself a favor and run it though a loop } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.