vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   javascript hide problem (https://vborg.vbsupport.ru/showthread.php?t=163081)

ragtek 11-19-2007 07:17 AM

javascript hide problem
 
i've made an ajax profileditor

http://www.ragtek.org/tutorials/editor.htm
the fields are coded like this:
HTML Code:

<div class="smallfont"><span id="usertitle">test</span></div>Einladungen: <span id="einladungen">200</span>
now when i want to edit the "Einladungen" field, its working fine
but for usertitle im getting this error:
Quote:

usertitle.style has no properties
[Break on this error] usertitle.style.display = '';
the strange thing is:

usertitle.style.display = 'none'; is working,
usertitle.innerHTML = xml_sender.fetch_data(fetch_tags(xml_sender.handle r.responseXML, 'linkhtml')[0]); is also working,
but usertitle.style.display = ''; isn't working

the fields are updated, just the showpart isn't working :/

Analogpoint 11-19-2007 07:29 PM

You can try
Code:

usertitle.style.display = 'inline';
// or
usertitle.style.display = 'block';

But this shouldn't be happening. There must be something else in your code causing this problem.

ragtek 11-19-2007 07:39 PM

hi
thx for answer

i don't know
as i said its the same function as my edit
edit() is working
edittitle() not
http://www.ragtek.org/forum/clientscript/profilajax.js

Analogpoint 11-19-2007 07:44 PM

Could there be a problem with using the same global variable inputobj in both functions? Try declaring them as local variable in the functions with var inputobj = 'xxxx';

ragtek 11-19-2007 07:57 PM

i changed it=> same error
i think i'm missing something

Analogpoint 11-20-2007 01:13 PM

Add some debugging stuff:

Code:

function savetitle(){
        if (editstate==true){

                if (xml_sender.handler.readyState == 4 && xml_sender.handler.status == 200)
                {
                        if (xml_sender.handler.responseXML)
                        {
                                alert(usertitle); // should say HTML object or somthing
                                usertitle.innerHTML = xml_sender.fetch_data(fetch_tags(xml_sender.handler.responseXML, 'linkhtml')[0]);
                                container1.removeChild(editobj);
                                alert(usertitle.innerHTML);
                                alert(usertitle.style);
                                alert(usertitle.style.display);
                                usertitle.style.display = 'block';
                                editstate=false;
                        }
                }
        }
}


ragtek 11-20-2007 03:10 PM

1. alert= my input
2,3 => undefined

--------------- Added [DATE]1195581708[/DATE] at [TIME]1195581708[/TIME] ---------------

problem solved
i used a wrong variable so usertitle was the object + the input
shame on me

Analogpoint 11-20-2007 04:51 PM

Good.

A suggestion also for you. You can make your edit, presave & save functions more generic, or even encapsulate them in an object, so you can reuse the same code for each of your fields Einladung, title etc.

ragtek 11-20-2007 05:02 PM

hi

thx 4 the tipp, (i wanted to make it with objects) but atm i don't realy understand the oop part :/
i can use it by copy & paste ( i'm doing it for my ajax prefix addon http://www.ragtek.org/tutorials/select.htm ) but one thing is just copy,paste and change the objects and the other thing is to realy understand it and to use it by own things:D


All times are GMT. The time now is 02:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01022 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete