![]() |
Change text on page based on id??
Hi,
I'm trying to add a some text to my site that changes depending on the element id but i think the JS function is incorrect. Code:
Code:
|
If you use
Code:
<input id="mode" ...>Code:
document.getElementById('mode').value = "Manual";Code:
<h1 id="mode" "></h1>Code:
document.getElementById('mode').innerHTML = "Manual"; |
Brilliant. Thank you very much :thumbsup:
I'll update my stuff and report back! |
All working :), Again many thanks.
|
And a wee bit more help required ;-)
Evening All,
Just to go one step further on this..... I'm looking to expand this to to maybe 100 to 150 different phrases based in the datamem14 value and was wondering if I can do this either via a lookup table, external .txt file or 'For to Loop'?? Any recommendations appreciated. :thumbsup:. Code:
<script language="javascript"> |
An array would probably be easiest as then you'd only need a single statement to do the assignment.
Code:
<script type="text/javascript"> |
Lookup table is easiest. External file may be best. You have to decide that part.
Lookup table is trivial: Code:
var phrases = [Code:
var phrases = { |
That's flipping great. Thanks!:D
|
| All times are GMT +1. The time now is 02:13 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.