Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple javascript syntax question

Status
Not open for further replies.

shopwise

Technical User
Sep 22, 2008
52
US
Code:
document.getElementById( 'largeimage' ).alt=header;
document.getElementById('photoHeader').innerHTML=header;
what does .alt and .innerHTML stand for in the above code?
 
let me clarify my question:

are these variables or do they mean something in Javascript
 
".alt" is a property of the "img" object / element.

".innerHTML" is not as clear-cut. I'd say it's more of a 'pseudo-property' - set it, and it will overwrite the contents of most elements with the markup you provide.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
thanks for your response.

What the above code is accomplishing in my case is that an image which is marked with the id "largeimage" changes according to the current moused over thumbnail image and some caption text marked with the id "photoHeader" changes accordingly as well.

My question is as follows:

What if I want additional database fields that are part of this same recordset to behave in the above manner, do I simply add another row of

Code:
document.getElementById( 'new_image_variable' ).alt=header;

in the script code for image fields and

Code:
document.getElementById('new_text_variable').innerHTML=header;

for text fields? (and of course mark the applicable html tags with an id name which corresponds to new_image_variable or new_text_variable)
 
I'm not entirely sure I understand you, so why not just try it and find out? After all, curiosity may have killed the cat, but not any JavaScript developers that I know of :)

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top