| |
| |
| |
|
Page: 1 2 3
Comments:
<0> i need help on manipulating a frame with javascript <1> Yes? <0> my javascript is placed in say frame_a.html, how do i disable onclick event for all elements (including images, buttons, etc) in the frame_a.html when i redirect from frame_a.html to another page? <1> Capture the event and return false. <0> basically...i want to disable frame_a.html's document when user click on a hyperlink or submit button (could be normal button or image) to go to a nother page <0> if frame_a.html's frameset name is frameA, should i do window.frameA.captureEvent("onClick")? <0> Pilum: is that how i should do it? IE returns an error <1> Some good reading for you: http://www.quirksmode.org/js/introevents.html <0> Pilum: thanks... <0> Pilum: i tried this out -> if (window.event.type == "unload") { return false; } <0> Pilum: that doesn't work...nothing actually happened...i would like to disable all the document's contents when the unload event is triggered...how do i do this? <1> Clear the page? <0> Pilum: not clear...just disable all elements in the page...clickable images, buttons, fields, etc <1> You can't disable all of those. Not as such. <0> Pilum: oh..what's the closest thing to that i can do? <1> Capturing the click event.
<0> Pilum: what about disabling field elements like buttons? <1> Set .disabled=true; on them <0> Pilum: on each element? <1> Yes. <1> Should work on all form elements. <0> Pilum: i'm using an included javascript so that it could work on any pages that execute the javscript function <1> So? <1> document.forms[i].elements[j].disabled = true; <0> Pilum: so if i have to do -> if (window.event.type == "click") { /*how do i disable elements here?*/ } <0> Pilum: right...i'll try that <1> (That's two for-loops in case you wondered) <0> Pilum: one for forms and the other for elements right? <1> And forms[] and elements[] take .length as any array. <0> Pilum: does this means that i need to specify either an id or name to each elements? <1> No. <1> You loop with the index number. <0> Pilum: javascript would automatically know which element and form names respectively through the forms and elements array index? <1> Javascript doesn't _need_ to know neither names nor ids for the forms and elements. <0> Pilum: ic...thanks again...i'll give that try <1> You might want to check wether there are any forms to avoid any errors though. <1> E.g. if(document.forms.length > 0) <0> Pilum: all right..thanks <0> Pilum: document.forms.length and document.elements.lenght would work for frames? <1> There is no document.elements. <1> It's document.forms.elements. <0> oh all right <1> You need the proper window reference if it's not in the same frame, but yes, it'll work. <0> so...to reference the frame...i should do like this -> window.frameA.document.forms <1> window.frames['frameA'].document.forms <1> Or, probably, toip.frames['frameA'].document.forms <1> *top <0> right...i see...thanks... <0> is there any way not to specify the form name? so that my script could be smart reused in different pages? <0> top.frames[i].document.forms probably? <1> No need to specify form name. <0> oh...sorry...my mistake... <0> Pilum: thanks a whole lot mate...it worked! <0> Pilum: by the way you mentioned that it's not possible to disable image clicks this way...but is there a way to disable hyperlinks? <1> Nope. <0> all right...thanks <2> kjsdfsdf <3> greetings o java gurus! <3> I'm wodering if anyone could show me how to round to the nearest .25 in javascript? <1> Java has nothing to do with javascript. <3> I've got it rounding to .5 by using Math.round(var*2)/2 <3> can't seem to get it to round to .25 though, and need to for calculations <1> Math.round(var*100)/100 <3> that doesn't seem to do it... <3> for example <3> I get 8 from 1700 - 915 <3> erm <3> I get 8 from 1700 - 915 / 100 <3> when it should be 8.25, right? <3> or 8.75 <1> Yes. <3> but it shows 8 <3> here's my code: <3> mpg = Math.round(mpg*100)/100; <1> Works just fine here. Even though it's no point in rounding in your example. :-) <3> hmmm <3> can I post my code for you to test?
<4> sure! <4> :D <3> <script> <3> function d(){ <3> var a = document.time.start.value; <3> var b = document.time.end.value; <3> var c = document.time.end2.value; <3> var d = document.time.lun.value; <3> a=(a*1); <3> d = (d*1); <3> if(c=="pm"){ <3> b=(b*1) + (1200*1); <3> mpg=(((b-a))/100)-d; <3> } else { <3> mpg=(((a-b))/100)-d; <3> } <3> mpg = Math.round(mpg*2)/2; <3> if(mpg > 8){ <3> var bnk = mpg-8; <3> document.time.banker.value=bnk; <3> } else { <3> bnk=0; <3> } <3> document.time.regular.value=(mpg-bnk); <3> } <3> </script> <3> it's to calculate the number of hours between two times. <3> right now it works if I anter in 900am to 530pm <3> will give 8.5 <3> but 915am to 530pm will not round properly. <4> :D:D:D <5> beat me <5> i got the ban in tho <1> :-) <1> Teamwork hehe <4> hehe <6> if i can use createElement() to create an element, can i use destroyElement to get rid of one? <4> i'd use appendChild <4> and what was the other one.... <4> i dunno i still hate js :D <6> i hate it too <6> but sometimes its needed <6> ok appendchild is a good idea <4> its good, i hate it for other reasins <4> reasons <6> using appendChild can i refernece the child by the id <4> yeah i think yes, Pilum will tell you hes the brain:P <1> removeChild <4> oh yeah remove yeah yeah <4> its like abortion of bytes! <6> ok thanks <6> ha, i just not seen how funny that was <7> is there any way to start a "<meta http-equiv="refresh" content="60;url=index.html">" through javascript. What im doing is a cgi script that loads two different pages, and i need one to refresh and one not to. The pages are 90% the same, so i make the page and print out whats different. Only other way to do it is to make two entirely different output pages. <1> setTimeout("window.location.href=index.html",60000); <7> ahh. Thx. <7> Pilum, that script wont work. FireFox says Syntax error and points at setTimeout( <7> nvm i fixed it <1> Ah yes. <1> Quotes hehe. <8> lolz <9> can someone tell me what's wring with this line of code? <9> var hammertime=1; if (hammertime) stop; <4> lol <9> why doesn't it do anything? <4> rdw, what the hel are you doing in here <8> lol <10> lol <8> pieg: jsBB plz <10> yeah that was a quick laugh :) <4> LOOOOOOL <9> if i remove that line, the script runs fine though <1> Twyce_Dailey: "stop"? <9> Pilum - hemmertime? <9> *hammertime
Return to
#javascript or Go to some related
logs:
rhel4 drdb heartbeat packages small bisnass #AllNiteCafe daestl horoscobes #MissKitten mirc give acces #linux #linuxhelp #skype
|
|