![]() |
Two Javascript Problems
One:
I have been using innerHTML to dynamically update my page. I have added the following function HTML Code:
<script> 1) I click on 'Add some more Attributes' three times. the default value is 'magicfind' 2) I change the vale of the second one to 'ads' 3) I click on 'Add some more Attributes' once more All the value of the second one has returned to 'magicfind' So basically every time you click on 'Add some more Attributes' all the values are reset to the default value. Two: These two problems are related with one and other. For some of the option values there will be default values. Example: For the attribute 'ads' there will have to be a default value, so i need to disable the input beside it, and put a value in it. Here is my function so far. HTML Code:
<script> I do have a proper form setup. HTML Code:
<a href="#" onClick="add_stats()">Add some more Attributes</a> ~Cody Woolaver |
Sorry for the bump, its just that ive been working on this script for a good 3 weeks, and its getting exausting. After this part is done, i will be able to move on, but i cant go anyfurther without this script working. Please help me
|
It would be better if you where creating the select menu dynamicaly using DOM and appending and removing as needed. Creating the whole select menu then using innerHTML is outdated and causes many issues.
As a side not. You should really put that in a seperate js page so that it will be cached by the users browser. |
Sorry, i just got help from another site.
HTML Code:
<script> ~Cody Woolaver |
Here is a comprehensive list of select options.
http://www.w3schools.com/htmldom/dom_obj_select.asp I still recomend you take a more comprehensive DOM aproach. |
Javascript is certainly not my strong suit, but here is a solution:
HTML Code:
<script> |
All times are GMT. The time now is 02:31 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|