Jump to content

alzami

Members
  • Posts

    95
  • Joined

  • Last visited

Everything posted by alzami

  1. that's the easeljs.js file.i have used it in other codes.it works fine.it is confusing me...i have just started to learn easeljs.never used constructor with easeljs though
  2. i use the same code i posted above and pressed F12 in firefox.which showing me this error......
  3. edited my answer.pls check it out.i have been trying different things with the codes i have written after posting here.sorry if i confused you
  4. here i am trying to create a red ball which is an instance of simpleBall constructor.but the code i've written is not drawing anything on the canvas.i am not sure what is wrong in my code.please help me out!!! <html><head><script src="easeljs.js"></script></head><body><canvas id="mycanvas" width="1000" height="500" style="border:1px solid black;"></canvas><script>function makeit(){function simpleBall(color,radius){ this.color=color; this.radius=radius; this.initialize(); this.x; this.y;}simpleBall.prototype.initialize=function(){ this.s=this.getGraphics(); } simpleBall.prototype.getGraphics=function(){ var s=new createjs.Shape(); s.graphics.beginFill(this.color).drawCircle(0,0,this.radius); return s; }var canvas=document.getElementById("mycanvas");var stage=new createjs.Stage(canvas);var ball=new simpleBall("red",10);ball.x=100;ball.y=100;stage.addChild(ball);stage.update();}window.onload=makeit;</script>
  5. i made a random logo and managed to make it upside down and half of it invisible like a reflection .everything is fine except the number " 5 ".can't figure out how to make it half invisible according to the size and shape of the reversed logo.pls help me out (POSTED THE CODE IN THE JSFIDDLE TO MAKE THE POST SIMPLER) http://jsfiddle.net/humptydumpty45/UBdJU/#username ctx.translate(w,h+100/2);ctx.rotate((Math.PI/180)*180);ctx.translate(-w,-(h+100/2));ctx.textAlign="center";ctx.textBaseLine="middle"ctx.font="bold 60px 'Times New Roman', Times, serif";ctx.fillStyle="black";ctx.fillText("5",w,h+56);} i want to erase the lower portion of the number "5" which is upside down
  6. thanks.z index setting works fine for firefox.but scale is not increasing and z index also not working in chrome and opera.
  7. in my color chart, I have set 3 addEventListeners for this chart. [*][*]click on any color(it will transform the viewing scale i,e; zoom the color element for better view)[*]an event for selecting the color by double clicking on it(it will show the color hex code inside a div)[*]an mouseout event (which will retrun the scale size to its normal size) Everything works fine. The problem is after 3 to 4 time experiment with the color chart small elements behind the zoomed element is visible and if mouse coursor touches them mouseout event triggers which is not desirable.mozila ,opera, chrome both behaving the same.opera and chrome not even zoom the element properlywhat's the reason and how can it be fixed? <html><head><style>#colorchart{ position:fixed; width:250px; height:250px; padding:0px; margin:0px; left:0px; top:200px;}</style></head><body onload="initialize();" ><script>function initialize(){var table = document.getElementById('colorchart');table.addEventListener('click', function (event) { var target = event.target||event.srcElement; if (target.tagName == 'TD') { target.style.webkitTransform='scale(15,15)'; target.style.oTransform='scale(15,15)'; target.style.mozTransform='scale(15,15)'; target.style.transform='scale(15,15)'; target.addEventListener('dblclick',function(event){ var newTarget=event.target; if(newTarget.tagName=='TD'){ document.getElementById("mydiv").innerHTML=newTarget.bgColor; }},false); } target.addEventListener('mouseout',function(event){ var againTarget=event.target;if(againTarget.tagName=='TD'){ againTarget.style.webkitTransform='scale(1,1)'; againTarget.style.oTransform='scale(1,1)'; againTarget.style.mozTransform='scale(1,1)'; againTarget.style.transform='scale(1,1)'; } },false);}, false);}</script><table id="colorchart" > <tr><td bgColor="#FBEFEF"></td><td bgColor="#FBF2EF"></td><td bgColor="#FBF5EF"></td><td bgColor="#FBF8EF"></td><td bgColor="#FBFBEF"></td><td bgColor="#F8FBEF"></td><td bgColor="#F5FBEF"></td><td bgColor="#F2FBEF"></td><td bgColor="#EFFBEF"></td><td bgColor="#EFFBF2"></td><td bgColor="#EFFBF5"></td><td bgColor="#EFFBF8"></td><td bgColor="#EFFBFB"></td><td bgColor="#EFF8FB"></td><td bgColor="#EFF5FB"></td><td bgColor="#EFF2FB"></td><td bgColor="#EFEFFB"></td><td bgColor="#F2EFFB"></td><td bgColor="#F5EFFB"></td><td bgColor="#F8EFFB"></td><td bgColor="#FBEFFB"></td><td bgColor="#FBEFF8"></td><td bgColor="#FBEFF5"></td><td bgColor="#FBEFF2"></td><td bgColor="#FFFFFF"></td></tr> <tr><td bgColor="#F8E0E0"></td><td bgColor="#F8E6E0"></td><td bgColor="#F8ECE0"></td><td bgColor="#F7F2E0"></td><td bgColor="#F7F8E0"></td><td bgColor="#F1F8E0"></td><td bgColor="#ECF8E0"></td><td bgColor="#E6F8E0"></td><td bgColor="#E0F8E0"></td><td bgColor="#E0F8E6"></td><td bgColor="#E0F8EC"></td><td bgColor="#E0F8F1"></td><td bgColor="#E0F8F7"></td><td bgColor="#E0F2F7"></td><td bgColor="#E0ECF8"></td><td bgColor="#E0E6F8"></td><td bgColor="#E0E0F8"></td><td bgColor="#E6E0F8"></td><td bgColor="#ECE0F8"></td><td bgColor="#F2E0F7"></td><td bgColor="#F8E0F7"></td><td bgColor="#F8E0F1"></td><td bgColor="#F8E0EC"></td><td bgColor="#F8E0E6"></td><td bgColor="#FAFAFA"></td></tr> <tr><td bgColor="#F6CECE"></td><td bgColor="#F6D8CE"></td><td bgColor="#F6E3CE"></td><td bgColor="#F5ECCE"></td><td bgColor="#F5F6CE"></td><td bgColor="#ECF6CE"></td><td bgColor="#E3F6CE"></td><td bgColor="#D8F6CE"></td><td bgColor="#CEF6CE"></td><td bgColor="#CEF6D8"></td><td bgColor="#CEF6E3"></td><td bgColor="#CEF6EC"></td><td bgColor="#CEF6F5"></td><td bgColor="#CEECF5"></td><td bgColor="#CEE3F6"></td><td bgColor="#CED8F6"></td><td bgColor="#CECEF6"></td><td bgColor="#D8CEF6"></td><td bgColor="#E3CEF6"></td><td bgColor="#ECCEF5"></td><td bgColor="#F6CEF5"></td><td bgColor="#F6CEEC"></td><td bgColor="#F6CEE3"></td><td bgColor="#F6CED8"></td><td bgColor="#F2F2F2"></td></tr> <tr><td bgColor="#F5A9A9"></td><td bgColor="#F5BCA9"></td><td bgColor="#F5D0A9"></td><td bgColor="#F3E2A9"></td><td bgColor="#F2F5A9"></td><td bgColor="#E1F5A9"></td><td bgColor="#D0F5A9"></td><td bgColor="#BCF5A9"></td><td bgColor="#A9F5A9"></td><td bgColor="#A9F5BC"></td><td bgColor="#A9F5D0"></td><td bgColor="#A9F5E1"></td><td bgColor="#A9F5F2"></td><td bgColor="#A9E2F3"></td><td bgColor="#A9D0F5"></td><td bgColor="#A9BCF5"></td><td bgColor="#A9A9F5"></td><td bgColor="#BCA9F5"></td><td bgColor="#D0A9F5"></td><td bgColor="#E2A9F3"></td><td bgColor="#F5A9F2"></td><td bgColor="#F5A9E1"></td><td bgColor="#F5A9D0"></td><td bgColor="#F5A9BC"></td><td bgColor="#E6E6E6"></td></tr> <tr><td bgColor="#F78181"></td><td bgColor="#F79F81"></td><td bgColor="#F7BE81"></td><td bgColor="#F5DA81"></td><td bgColor="#F3F781"></td><td bgColor="#D8F781"></td><td bgColor="#BEF781"></td><td bgColor="#9FF781"></td><td bgColor="#81F781"></td><td bgColor="#81F79F"></td><td bgColor="#81F7BE"></td><td bgColor="#81F7D8"></td><td bgColor="#81F7F3"></td><td bgColor="#81DAF5"></td><td bgColor="#81BEF7"></td><td bgColor="#819FF7"></td><td bgColor="#8181F7"></td><td bgColor="#9F81F7"></td><td bgColor="#BE81F7"></td><td bgColor="#DA81F5"></td><td bgColor="#F781F3"></td><td bgColor="#F781D8"></td><td bgColor="#F781BE"></td><td bgColor="#F7819F"></td><td bgColor="#D8D8D8"></td></tr> <tr><td bgColor="#FA5858"></td><td bgColor="#FA8258"></td><td bgColor="#FAAC58"></td><td bgColor="#F7D358"></td><td bgColor="#F4FA58"></td><td bgColor="#D0FA58"></td><td bgColor="#ACFA58"></td><td bgColor="#82FA58"></td><td bgColor="#58FA58"></td><td bgColor="#58FA82"></td><td bgColor="#58FAAC"></td><td bgColor="#58FAD0"></td><td bgColor="#58FAF4"></td><td bgColor="#58D3F7"></td><td bgColor="#58ACFA"></td><td bgColor="#5882FA"></td><td bgColor="#5858FA"></td><td bgColor="#8258FA"></td><td bgColor="#AC58FA"></td><td bgColor="#D358F7"></td><td bgColor="#FA58F4"></td><td bgColor="#FA58D0"></td><td bgColor="#FA58AC"></td><td bgColor="#FA5882"></td><td bgColor="#BDBDBD"></td></tr> <tr><td bgColor="#FE2E2E"></td><td bgColor="#FE642E"></td><td bgColor="#FE9A2E"></td><td bgColor="#FACC2E"></td><td bgColor="#F7FE2E"></td><td bgColor="#C8FE2E"></td><td bgColor="#9AFE2E"></td><td bgColor="#64FE2E"></td><td bgColor="#2EFE2E"></td><td bgColor="#2EFE64"></td><td bgColor="#2EFE9A"></td><td bgColor="#2EFEC8"></td><td bgColor="#2EFEF7"></td><td bgColor="#2ECCFA"></td><td bgColor="#2E9AFE"></td><td bgColor="#2E64FE"></td><td bgColor="#2E2EFE"></td><td bgColor="#642EFE"></td><td bgColor="#9A2EFE"></td><td bgColor="#CC2EFA"></td><td bgColor="#FE2EF7"></td><td bgColor="#FE2EC8"></td><td bgColor="#FE2E9A"></td><td bgColor="#FE2E64"></td><td bgColor="#A4A4A4"></td></tr> <tr><td bgColor="#FF0000"></td><td bgColor="#FF4000"></td><td bgColor="#FF8000"></td><td bgColor="#FFBF00"></td><td bgColor="#FFFF00"></td><td bgColor="#BFFF00"></td><td bgColor="#80FF00"></td><td bgColor="#40FF00"></td><td bgColor="#00FF00"></td><td bgColor="#00FF40"></td><td bgColor="#00FF80"></td><td bgColor="#00FFBF"></td><td bgColor="#00FFFF"></td><td bgColor="#00BFFF"></td><td bgColor="#0080FF"></td><td bgColor="#0040FF"></td><td bgColor="#0000FF"></td><td bgColor="#4000FF"></td><td bgColor="#8000FF"></td><td bgColor="#BF00FF"></td><td bgColor="#FF00FF"></td><td bgColor="#FF00BF"></td><td bgColor="#FF0080"></td><td bgColor="#FF0040"></td><td bgColor="#848484"></td></tr> <tr><td bgColor="#DF0101"></td><td bgColor="#DF3A01"></td><td bgColor="#DF7401"></td><td bgColor="#DBA901"></td><td bgColor="#D7DF01"></td><td bgColor="#A5DF00"></td><td bgColor="#74DF00"></td><td bgColor="#3ADF00"></td><td bgColor="#01DF01"></td><td bgColor="#01DF3A"></td><td bgColor="#01DF74"></td><td bgColor="#01DFA5"></td><td bgColor="#01DFD7"></td><td bgColor="#01A9DB"></td><td bgColor="#0174DF"></td><td bgColor="#013ADF"></td><td bgColor="#0101DF"></td><td bgColor="#3A01DF"></td><td bgColor="#7401DF"></td><td bgColor="#A901DB"></td><td bgColor="#DF01D7"></td><td bgColor="#DF01A5"></td><td bgColor="#DF0174"></td><td bgColor="#DF013A"></td><td bgColor="#6E6E6E"></td></tr> <tr><td bgColor="#B40404"></td><td bgColor="#B43104"></td><td bgColor="#B45F04"></td><td bgColor="#B18904"></td><td bgColor="#AEB404"></td><td bgColor="#86B404"></td><td bgColor="#5FB404"></td><td bgColor="#31B404"></td><td bgColor="#04B404"></td><td bgColor="#04B431"></td><td bgColor="#04B45F"></td><td bgColor="#04B486"></td><td bgColor="#04B4AE"></td><td bgColor="#0489B1"></td><td bgColor="#045FB4"></td><td bgColor="#0431B4"></td><td bgColor="#0404B4"></td><td bgColor="#3104B4"></td><td bgColor="#5F04B4"></td><td bgColor="#8904B1"></td><td bgColor="#B404AE"></td><td bgColor="#B40486"></td><td bgColor="#B4045F"></td><td bgColor="#B40431"></td><td bgColor="#585858"></td></tr> <tr><td bgColor="#8A0808"></td><td bgColor="#8A2908"></td><td bgColor="#8A4B08"></td><td bgColor="#886A08"></td><td bgColor="#868A08"></td><td bgColor="#688A08"></td><td bgColor="#4B8A08"></td><td bgColor="#298A08"></td><td bgColor="#088A08"></td><td bgColor="#088A29"></td><td bgColor="#088A4B"></td><td bgColor="#088A68"></td><td bgColor="#088A85"></td><td bgColor="#086A87"></td><td bgColor="#084B8A"></td><td bgColor="#08298A"></td><td bgColor="#08088A"></td><td bgColor="#29088A"></td><td bgColor="#4B088A"></td><td bgColor="#6A0888"></td><td bgColor="#8A0886"></td><td bgColor="#8A0868"></td><td bgColor="#8A084B"></td><td bgColor="#8A0829"></td><td bgColor="#424242"></td></tr> <tr><td bgColor="#610B0B"></td><td bgColor="#61210B"></td><td bgColor="#61380B"></td><td bgColor="#5F4C0B"></td><td bgColor="#5E610B"></td><td bgColor="#4B610B"></td><td bgColor="#38610B"></td><td bgColor="#21610B"></td><td bgColor="#0B610B"></td><td bgColor="#0B6121"></td><td bgColor="#0B6138"></td><td bgColor="#0B614B"></td><td bgColor="#0B615E"></td><td bgColor="#0B4C5F"></td><td bgColor="#0B3861"></td><td bgColor="#0B2161"></td><td bgColor="#0B0B61"></td><td bgColor="#210B61"></td><td bgColor="#380B61"></td><td bgColor="#4C0B5F"></td><td bgColor="#610B5E"></td><td bgColor="#610B4B"></td><td bgColor="#610B38"></td><td bgColor="#610B21"></td><td bgColor="#2E2E2E"></td></tr> <tr><td bgColor="#3B0B0B"></td><td bgColor="#3B170B"></td><td bgColor="#3B240B"></td><td bgColor="#3A2F0B"></td><td bgColor="#393B0B"></td><td bgColor="#2E3B0B"></td><td bgColor="#243B0B"></td><td bgColor="#173B0B"></td><td bgColor="#0B3B0B"></td><td bgColor="#0B3B17"></td><td bgColor="#0B3B24"></td><td bgColor="#0B3B2E"></td><td bgColor="#0B3B39"></td><td bgColor="#0B2F3A"></td><td bgColor="#0B243B"></td><td bgColor="#0B173B"></td><td bgColor="#0B0B3B"></td><td bgColor="#170B3B"></td><td bgColor="#240B3B"></td><td bgColor="#2F0B3A"></td><td bgColor="#3B0B39"></td><td bgColor="#3B0B2E"></td><td bgColor="#3B0B24"></td><td bgColor="#3B0B17"></td><td bgColor="#1C1C1C"></td></tr> <tr><td bgColor="#2A0A0A"></td><td bgColor="#2A120A"></td><td bgColor="#2A1B0A"></td><td bgColor="#29220A"></td><td bgColor="#292A0A"></td><td bgColor="#222A0A"></td><td bgColor="#1B2A0A"></td><td bgColor="#122A0A"></td><td bgColor="#0A2A0A"></td><td bgColor="#0A2A12"></td><td bgColor="#0A2A1B"></td><td bgColor="#0A2A22"></td><td bgColor="#0A2A29"></td><td bgColor="#0A2229"></td><td bgColor="#0A1B2A"></td><td bgColor="#0A122A"></td><td bgColor="#0A0A2A"></td><td bgColor="#120A2A"></td><td bgColor="#1B0A2A"></td><td bgColor="#220A29"></td><td bgColor="#2A0A29"></td><td bgColor="#2A0A22"></td><td bgColor="#2A0A1B"></td><td bgColor="#2A0A12"></td><td bgColor="#151515"></td></tr> <tr><td bgColor="#190707"></td><td bgColor="#190B07"></td><td bgColor="#191007"></td><td bgColor="#181407"></td><td bgColor="#181907"></td><td bgColor="#141907"></td><td bgColor="#101907"></td><td bgColor="#0B1907"></td><td bgColor="#071907"></td><td bgColor="#07190B"></td><td bgColor="#071910"></td><td bgColor="#071914"></td><td bgColor="#071918"></td><td bgColor="#071418"></td><td bgColor="#071019"></td><td bgColor="#070B19"></td><td bgColor="#070719"></td><td bgColor="#0B0719"></td><td bgColor="#100719"></td><td bgColor="#140718"></td><td bgColor="#190718"></td><td bgColor="#190714"></td><td bgColor="#190710"></td><td bgColor="#19070B"></td><td bgColor="#000000"></td></tr></table>get color code<span style="color:blue;">(double click on your color):</span><div id="mydiv" style="width:100px;height:100px;border:1px solid black;color:red;"></div></body></html> here is the image of what is actually happening
  8. i replaced the "p" with a "div".another problem is i can not write outside the quotation mark both for p and div tag even if i clicked outside of quote though designMode is on for div/p tag.i can write only in the quotetion mark.why it happening?
  9. i am trying to learn how to make a text editor.here i creat a paragraph using "para" button.and inside the paragraph there will be a quote.Every time I press 'enter' within this paragraph, a new paragraph is created, rather than a line break tag (<br>). How can I force a line break tag to be created instead of a paragraph element?also i cant even get outside of the quote tag.though designMode is on and contenteditable is true for both paragrap and quote <head><meta charset="utf-8"><title>Untitled Document</title><style>*{margin:0px;padding:0px;}#idContent{ background-color:pink;}div{ border:1px solid black;}</style></head><body onLoad="loads();" style="position:relative;"><iframe id="idContent" width="600" height="280" contenteditable="true" ></iframe><input type="button" value="para" onClick="para();"><script>function loads(){ idContent.document.designMode="On";}function para(){ var m=document.createElement("p"); m.setAttribute('style',"border:1px solid black;height:100px;width:500px;position:relative;background-color:white;");m.setAttribute('designMode',"on");m.setAttribute('contenteditable',"true"); var t=document.createElement("q"); t.innerHTML="quote here"; t.setAttribute('designMode',"on"); t.setAttribute('contenteditable',"true"); m.appendChild(t); idContent.document.body.appendChild(m); }</script></body></html>
  10. yes something lyk that!
  11. trying to make a text editor.the "creatdiv" button is used to make a paragraph inside the iframe editor.but while typing inside the paragraph the texts overflows and spill out of the paragraph boundary.so my question is how can i manage to force the text to remain inside the paragraph boundary.and also want the paragraph boundary will increase along Y-direction as the amount of texts inside is being increased <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style>a { cursor:pointer; text-decoration:none;}img{ width:16px; height:16px;}#hide{ position:absolute; width:50px; height:50px; background-color:pink; border:1px solid black; top:210px; left:660px; padding:1px; display:none;}</style></head><body onLoad="loads();" style="position:relative;"><iframe id="idContent" width="600" height="280" contenteditable="true" ></iframe><input type="button" value="B" onClick="bolds();"><input type="button" value="l" onClick="ilink();"><input type="button" value="color" onClick="show();"><input type="button" value="UL" onClick="ul_list();"><input type="text" value="" list="datalist1" id="ff" /><datalist id="datalist1"><option value="1" ><option value="2" ><option value="3" ><option value="4" ><option value="5" ><option value="6" ><option value="7" ></datalist><input type="button" value="< font size" onClick="isize(ff.value);"><input type="button" value="creatdiv" onClick="crtdiv();"><div id="hide"><img src="yellow.jpg" onClick="icolor('yellow');"/><img src="red.jpg" onClick="icolor('red');"/><img src="violet.jpg" onClick="icolor('violet');"/><img src="black.jpg" onClick="icolor('black');"</div><script>var p=0;function loads(){ idContent.document.designMode="On";}function bolds(){ idContent.document.execCommand("bold",false,null);}function ilink(){ var m = prompt("put url here"); idContent.document.execCommand("CreateLink",false,m);}function show(){ var m=document.getElementById("hide"); m.style.display="block";}function icolor(col){ var m=document.getElementById("hide"); if(p==1){ idContent.document.execCommand("forecolor",false,'black'); p=0; } else{ idContent.document.execCommand("forecolor",false,col); setTimeout(function(){ m.style.display="none"; },5000); p=1;} }function ul_list(){ idContent.document.execCommand("InsertUnorderedList",false,null);}function isize(el){ idContent.document.execCommand("FontSize",false,el);}function crtdiv(){ var para=document.createElement("p"); para.innerHTML="dfdfdfdfkdf"; para.setAttribute('style',"background-color:green;background-image:url(image1.jpg);border-radius:10px;border:1px solid black"); idContent.document.body.appendChild(para); }</script></body></html> creatdiv function here function crtdiv(){ var para=document.createElement("p"); para.innerHTML="dfdfdfdfkdf"; para.setAttribute('style',"background-color:green;background-image:url(image1.jpg);border-radius:10px;border:1px solid black"); idContent.document.body.appendChild(para); }
  12. thanks!spell correction works but it is not allowing me to click on the link and visit the desired page.rather "open in a new tab" using mouse's right button works.i want to make it a clickable link. iframe tag is used to creat browser window inside the main page(as far as i know).so why should i need an iframe tag here? // what i am trying to do is select a word or group of word and replae it with a link
  13. alzami

    if(!var_name)

    thanks!what actually cofused me is i removed the timer_is_on var from the editor and codes worked fine.so i wonder why use an extra var when it is not necessary!!
  14. i want to creat link using selected text.codes aren't working.how can i fix this? <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style>#its{ border:1px solid black;}</style></head><body><div id="its" contenteditable="true" ><p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p></div><input type="button" value="select and change" onClick="addLink();"><script>function addLink(){var links=prompt("add link","http://");document.execCommand('creatLink',false,links);}</script></body></html>
  15. i want to creat link using selected text.codes aren't working.how can i fix this? <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style>#its{ border:1px solid black;}</style></head><body><div id="its" contenteditable="true" ><p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p></div><input type="button" value="select and change" onClick="addLink();"><script>function addLink(){var links=prompt("add link","http://");document.execCommand('creatLink',false,links);}</script></body></html>
  16. browser detecting problem .before that codes works fine.its job is to make a div up and down within a period of time.after 10/12 times it crashes?what is the reason and how can it be fixed? <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style>#its{ width:200px; height:0px; background-color:blue; display:block; color:white;}#h{ background-color:green;}</style></head><body><div id="its">this is it</div><input type="button" value="down" onClick="view();" id="h"><script>var i=100;function view(){ var m=document.getElementById("its"); var n=document.getElementById("h"); m.style.webkitTransition="height .5s ease-in-out"; m.style.height="100px"; n.value="up" setTimeout(function(){ m.style.height="0px"; n.value="down"; },600); setInterval(view,1200); } </script></body></html>
  17. alzami

    if(!var_name)

    in this example what is the use of the variable (timer_is_on)? http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_settimeout_cleartimeout2 it is not even needed here. what is the use of If(!timer_is_on) in the function startcount()??
  18. what is the actual meaning of these statement #if(!var_name) #if(var_name)
  19. i am trying a dynamic max power and "x" value input.everything is fine the problem is i can not replace the (x^something) dynamically with replace() method. <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style>#gap{ width:200px; height:50px; border:1px solid black;}thiss{ width:200px; height:50px;}</style></head><body><div id="gap"></div><p id="thiss"></p><input type="button" value="replace this" onClick="change();"><script>function change(){ var m=document.getElementById("gap"); var n=document.getElementById("thiss"); var t=document.getElementById("thiss").innerHTML; var power=prompt("input highest power of x:"); var i; var arr=new Array(); for( i=power;i>=0;i--){ arr[i]=prompt("coeff of x^"+i); } i=power; for(i=power;i>=0;i--){ if(arr[i]>0 && i==power){ n.innerHTML += arr[i]+"*x^"+i; } else if(arr[i]<0 && i==power){ n.innerHTML += arr[i]+"*x^"+i; } else if(arr[i]>0 && i!=power){ n.innerHTML += "+"+arr[i]+"*x^"+i; } else if(arr[i]<0){ n.innerHTML += arr[i]+"*x^"+i; }else if(arr[i]==0){ n.innerHTML += ""; } } var x_val=prompt("solve with x =");i=power;for(i=power;i>=0;i--){ m.innerHTML=eval(t.replace(/x^i/,"Math.pow(x_val,i)"));} }</script></body></html> mainly problem is here.i know this is garbage .but how can it be fixed.how can i replace using variable for(i=power;i>=0;i--){ m.innerHTML=eval(t.replace(/x^i/,"Math.pow(x_val,i)"));}
  20. ok thanks!that problem had been solved.
  21. what did you just do here? n.replace(/x3/g,""+Math.pow(3,3)) i mean the rule behind it(actually i am not following any books.so little explanation will be a great help)
  22. i am not suggesting anything.i wanted to use a ^ sign to make the statement more understandable.and i am using the string.replace function for the first time.it worked if i just use x2 instead of x^2. i used a backslash to seperate ^ as suggested.it shows the replaced string in the text field .not evaluating. of course there is a mistake.i am failing to figure it out. this simple code works fine <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style>#gap{ width:200px; height:50px; border:1px solid black;}</style></head><body><div id="gap"></div><p id="thiss">3*x3</p><input type="button" value="replace this" onClick="change();"><script>function change(){ var m=document.getElementById("gap"); var n=document.getElementById("thiss").innerHTML; var rep1=n.replace(/x3/g,"3"); m.innerHTML=rep1 var t=eval(m.innerHTML); m.innerHTML=t;}</script></body></html> if i pass Math.pow(3,3) in stead of 3 eval function don't evaluate it.It pulish 3*Math.pow(3,3)in the screen. but this script works fine....but what could be the mistakes in previous code? <script>function change(){ var m=document.getElementById("gap"); var n=document.getElementById("thiss").innerHTML; var rep1=eval(n.replace(/x3/g,"Math.pow(3,3)")); m.innerHTML=rep1;}</script>
  23. if you see my codes in post 1 you will find that i used eval function there to evaluate.not worked
×
×
  • Create New...