Help Logs Database

Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Ircnet  |  Dalnet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13

<chino> hm
<frb> fixing it for any cut and paste errors I introduced, but you get the idea
<chino> i think i can do it another way
<frb> use the language to your advantage
<frb> ok, I need to get back to making a VPN
<chino> for(var i in peices){ t[i] = document.getElementById(peices[i]); t[i].X = parseInt(t[i].style.width) / 2 ; t[i].Y = parseInt(t[i].style.height) / 2 ;}
<chino> hows that ?
<frb> you need to initialize t[i] as a new object before setting props
<chino> :\ how come ?
<frb> actuall, maybe not
<chino> its not working though
<chino> so something is worng
<chino> its an array
<frb> venkman is your friend
<chino> why would i make t an object ?
<frb> how can you set properties without an object?
<chino> idk
<chino> isn't that what t[i] = document.getElementById(peices[i]); is doing ?
<frb> what you should really do is watch your code in the firefox js console
<frb> then pastebin your code and ask about any errors you can't handle
<chino> there is no error lol
<chino> i just need a way to make a dynamic name
<chino> or im **** coding out all 32 peices
<frb> the real question is what you want to do
<frb> do you really need all 32 to be persistant?
<chino> yea
<chino> its a chess board
<chino> want to be able to move all 32 around with mouse
<chino> i need to join 2 numbers togther as a string
<chino> not as a math function
<chino> how do i do that ?
<frb> num1 + "" + num2
<chino> lol i'm trying everything here
<frb> you can put the "" anywhere before the second number, so "" + num1 + num2 would also work
<chino> ntohing going through
<Ungy> frb so for my dynamic state I shoudl have an onchange event on my country correct?
<frb> Ungy: correct
<Ungy> thanks
<chino> can someone just show me how to make a dynamic variable ?
<lalala`> i have an absolutely positioned div, and inside divs with display:none, when i display them using javascript, some of the divs contents overflows the boundaries of the containing div. is it possible to make the containing div grow?
<Raevel> chino there's a toString() you can use for other types than strings
<Raevel> toString() property*
<Ungy> if I want to check a value of a selet box it is form.inputtype[index].selected correct?
<Raevel> selectedIndex
<Ungy> is there a way I can check the value instead of index?
<frb> only if you walk it yourself
<Ungy> ugg ok
<Raevel> well..
<Raevel> select.getElementsByTagName("option")[select.selectedIndex]
<Raevel> .value
<lith> dont even have to do [select.selectedIndex] just do getElementById('select').value and it will pull the value
<lith> of what is selected that is
<Ungy> sweet thanks
<lith> np
<chino> FINALLY!
<chino> was a dumb reason it wasn't working
<chino> Raevel: what was your url again ?
<chino> to tell you the truth it didnt' work anyway though
<Raevel> www.edea.se/scripts/js/puzzle/
<Ungy> is it document.write to display somethign I am trying to figure out why my thing isn't working
<chino> Raevel: how do you find out where it should be snap doesn't really say it just says it shoudl be there
<lith> ungy: also you can use innerHTML of a text container (span/div/etc) to change data
<frb> innerHTML is unsafe
<Raevel> chino well it checks the id or whatever it is on the piece (x,y coord), and then multiplies those values with the width of a piece
<lith> frb: unsafe?
<frb> and a div isn't a text container
<frb> neither is a span really
<frb> lith: browsers don't have to let you change innerHTML at all
<lith> frb: which ones dont?
<frb> I've seen people with issues here before
<frb> you can use the DOM to create text nodes and then replace or appendChild
<lith> frb: hm... i use innerHTML often and have never seen a problem.... but i'll change to a better way
<Ungy> can I do an elseif in javascript?
<Bebabo> Ungy: yes, simply 'else if'
<galimon> would http://wiki.flawedaxiom.com/HandlingEvents be the best way of adding an 'onclick' or 'onmousedown' to a newly created element? (row = document.createElement("TR");)
<galimon> got it, nm
<Ungy> if I wanted to set an input value how would I do that like?? document.getElementByID('cardno').value = '4';
<frb> if you gave the input box an id instead of a name
<frb> I always use names on input elements, then just get a ref to their form
<Ungy> yes the id of the box is cardno
<frb> anyway, yes, that will work
<Ungy> ahh well I use xhtml so I only use id's
<frb> name is valid on form inputs
<frb> else how can you have an array?
<Ungy> frb hmm I thought it would but it isn't must be a firefox thing
<Ungy> frb makes sense
<frb> also, xhtml is overrated and prone to errors
<Ungy> frb I love it personaly I ahve had no problems with it so far
<Ungy> been using it for 3 years now but if I do find a strange problem I will let you know ;-)
<galimon> *wonders why the addevent method doesn't want to work in IE)
<frb> galimon: because it's attachEvent("onevent", handler, true) in IE
<galimon> so http://wiki.flawedaxiom.com/HandlingEvents doesn't work?
<blackbook> Ungy: you capitalised getElementById() wrong
<galimon> nm
<flashbang> hey, how can i autosubmit a form in javascript?
<Ungy> blackbook thanks for the point out
<flashbang> anyone?
<blackbook> .submit() on the form
<solemnwarning> hi all
<solemnwarning> whats javascript to go back a page?
<fatbrain> hello fatbrain_
<flashbang> history.go(-1)
<fatbrain_> lo
<blackbook> or history.back()
<solemnwarning> so <a href="history.go(-1)"> will go back a page?
<flashbang> blackbook: if i don't know the name of the form, but it's the first form on the page, can I just do document.forms[0].submit?
<flashbang> solemnwarning: yeah, either that or what blackbook said
<solemnwarning> k
<blackbook> flashbang: correct. or document.getElementsByTagName("form")[0].submit();
<solemnwarning> do i need a javascript: in the link?
<flashbang> sweet, thanks
<flashbang> solemnwarning: doesn't hurt
<flashbang> but no
<solemnwarning> k
<flashbang> i don't think onClick needs a javascript: prefix
<fatbrain> you NEVER use javascript:
<fatbrain> and you NEVER put JavaScript in your href attribute.
<CPUnerd> :-)
<flashbang> fatbrain: really? is it a validation issue or somesuch?
<fatbrain> flashbang: href <- hyperlink reference, if you want to add JavaScript behavior, add it to the onclick event.
<flashbang> ah
<Julianyus> hi
<Gomo1> Hi
<Gomo1> What's a colon (" : ") used for in JS?
<flashbang> ternary operator?
<fatbrain> Gomo1: Nothing, it's part of the conditional-operator (the tenary operator)
<fatbrain> conditional-operator (the trenary-operator)> expr ? true-expr : false-expr;
<Gomo1> Mmmm no it doesn't look like that
<flashbang> pastebin the code
<Gomo1> init : function() {
<Gomo1> Looks like that
<CPUnerd> imagine this
<flashbang> heh, never seen anyting like that before
<CPUnerd> function init()
<Gomo1> and then there is function code in there
<flashbang> CPUnerd: so is it some OOP operator?
<CPUnerd> yep
<CPUnerd> look and example
<CPUnerd> http://websvn.bluga.net/wsvn/HTML_AJAX/trunk/js/HTML_AJAX.js?op=file&rev=0&sc=1
<flashbang> so it means function "init" inherits from the base function?
<fatbrain> Then it's for object-literals.
<fatbrain> NO!
<flashbang> eek
<CPUnerd> nop
<fatbrain> var myObject = { propName: function() { ... function is prop-value ... } };
<flashbang> yeah.. i'm gonna go ahead and stick with procedural programming
<Gomo1> o_O
<Gomo1> so if i have like
<halibut> how can I get access to table content through javascript? document.tables[0] does not work


Return to javascript
or
Go to some related logs:


Copyright © 2005 www.irclogs.ws. All rights reserved. » disclaimer » contact