Jump to content

Rachit Shah

Members
  • Posts

    30
  • Joined

  • Last visited

About Rachit Shah

  • Birthday 05/07/1982

Contact Methods

  • Website URL
    http://www.rachitshah.com
  • ICQ
    0
  • Yahoo
    rachs1982

Profile Information

  • Location
    Hyderabad

Rachit Shah's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. You can put your javascript in a file instead of putting it inline.the js file has the javascript that otherwise you would use inline.Code 1: <script language=javascript>alert("rachit");</script> Now make a file calles scr.js in which you would put this entry Code 2:<script language=javascript src=./scr.js></script> Code 2 will give same effect as Code 1
  2. Better use server side scripting lilke asp, php or python then only you can preven this thing.
  3. I think all codes are equivalent.Internally javascript would take same time to execute the functions in all 4 cases.One thing is that line of the code should be as small as possible.Unnessesarily putting .onclick method would cause an extra line to be parsed by the browser. That may delay the loading with a fraction of second. This is overhead because you can eliminate this by associating functions in the tags definition.element.onclick=fun() would be internally same as < onclick=fun()>I suggest it would be better to associate functions in Tags instead of defining in the window.onload function.
  4. plz remove this document.location otherwise it will redirect to google in case of authentication failure even. }document.location='http://www.google.com';}</script>
  5. Plz remove submit button, otherwise it will try to submit the form to the url specified in action attribute.I have replaced it with button
  6. U can use <div> for this. Check the example. <html> <head> <script language = "Javascript"> <!-- // SHOW MENU function showTipBox(layerName,imgName){ img = getImage(imgName); TipBoxTop = getImagePageTop(img); // TIP BOX TOP POSITION TipBoxLeft = getImagePageLeft(img); // TIP BOX LEFT POSITION if (NS4 || IE4) { if (timeOn != null) { clearTimeout(timeOn) hideLayer(onLayer) } if (NS4 || IE4) { eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="'+layerVis+'"'); eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top="'+TipBoxTop+'"'); eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left="'+TipBoxLeft+'"'); } onLayer = layerName } } window.onerror = null; var bName = navigator.appName; var bVer = parseInt(navigator.appVersion); var NS4 = (bName == "Netscape" && bVer >= 4); var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4); var NS3 = (bName == "Netscape" && bVer < 4); var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4); var menuActive = 0 var menuOn = 0 var onLayer var timeOn = null // LAYER SWITCHING CODE if (NS4 || IE4) { if (navigator.appName == "Netscape"){ layerStyleRef="layer."; layerRef="document.layers"; styleSwitch=""; layerVis="show"; layerHid="hide"; }else { layerStyleRef="layer.style."; layerRef="document.all"; styleSwitch=".style"; layerVis="visible"; layerHid="hidden"; } }// HIDE MENU function hideLayer(layerName){ if (menuActive == 0) { if (NS4 || IE4) { eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="'+layerHid+'"'); } } }// TIMER FOR TIP BOX MOUSE OUT function linkTimer() { timeOn = setTimeout("btnOut()",500) }// MOUSE OUT function btnOut(layerName) { if (menuActive == 0) { hideLayer(onLayer) } }// GET IMAGE function getImage(name) { if (NS4) { return findImage(name, document); } if (IE4) return eval('document.all.' + name); return null; } function findImage(name, doc) { var i, img; for (i = 0; i < doc.images.length; i++) if (doc.images[i].name == name) return doc.images[i]; for (i = 0; i < doc.layers.length; i++) if ((img = findImage(name, doc.layers[i].document)) != null) { img.container = doc.layers[i]; return img; } return null; } function getImagePageLeft(img) { var x, obj; if (NS4) { if (img.container != null) return img.container.pageX + img.x; else return img.x; } if (IE4) { x = 0; obj = img; while (obj.offsetParent != null) { x += obj.offsetLeft; obj = obj.offsetParent; } x += obj.offsetLeft; return x; } return -1; } function getImagePageTop(img) { var y, obj; if (NS4) { if (img.container != null) return img.container.pageY + img.y; else return img.y; } if (IE4) { y = 0; obj = img; while (obj.offsetParent != null) { y += obj.offsetTop; obj = obj.offsetParent; } y += obj.offsetTop; return y; } return -1; } // --> </script> </head> <body> <a href="#" onMouseOut="linkTimer()" onMouseOver="showTipBox('Delete','imgDel')"><font class="font" color="#CC6600" face="Arial, Helvetica, sans-serif" size="2">Tip Box</font></a> <img src="/images/shim.gif" width="5" height="5" border="0" name="imgDel"> <div id=Delete style="position: absolute; width: 228px; height: 33px; z-index: 1; visibility: hidden"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#990000"> <table border=0 cellpadding="4" cellspacing="1"><tr> <td bgcolor="#FFFFFF"><img src="/images/shim.gif" width="2" height="2" border="0"><font face="Arial, Helvetica, sans-serif" size="2" color="#000066">This is a text link tip box : </font> <font face="Arial, Helvetica, sans-serif" size="2">This<br> function should be used for ..... ....... ........ </font></td> </tr> </table></td> </tr> </table> </div> </body></html>
  7. Rachit Shah

    tags

    Does it mean that U want to display all Tags present in the same web page.OrIt means that U want to display all tags client browser can support.
  8. Thats not necesssary at all. Its working. Check this. I think Its information for website downloaders like 'website copier' which downloads sites automatically. <html><head><meta http-equiv="Content-Language" content="en-us"></head><script type="text/javascript"><!--function ValidateAuthentication() {var UserName=document.getElementsByName('UserName').item(0).value;var Password=document.getElementsByName('Password').item(0).value;if(UserName == 'rachit' && Password == 'password1'){alert('Successfully Authenticated - Redirecting to google.com');document.location='http://www.google.com';}else{alert('Failed to Authenticate - Put the code for error msg here');}}//--></script> <body><form ><table border="0" width="50%" id="table1" align=center><tr><td>User Name</td><td><input type="text" name="UserName" size="20" value='rachit'></td></tr><tr><td>Password</td><td><input type="text" name="Password" size="20" value='password1'></td></tr></table><p align="center"><input type="button" value="Submit" name="B1" onclick="ValidateAuthentication()"><input type="reset" value="Reset" name="B2"></p></form><table border="0" width="50%" id="table2" align=center><tr><td>Another input with same name</td><td><input type="text" name="UserName" size="20"></td></tr></table></body></html>
  9. When I am using document.body.innerHTML, I am getting<input type="button" onclick="writeIt()" value="Write">I dont know where the / has gone.Do anyone know How can I retrieve exact source line.(i.e with / in the tag source)
  10. alt attribute will put tip to the object in question. <img src="angry.gif" alt="Angry" />
  11. Check this. Just click submit. Based on authentication details, it will redirect to google. Key is document.location='http://www.google.com'; <html><head><meta http-equiv="Content-Language" content="en-us"></head><script type="text/javascript"><!--function ValidateAuthentication() {var UserName=document.getElementsByName('UserName').item(0).value;var Password=document.getElementsByName('Password').item(0).value;if(UserName == 'rachit' && Password == 'password1'){alert('Successfully Authenticated - Redirecting to google.com');document.location='http://www.google.com';}else{alert('Failed to Authenticate - Put the code for error msg here');}}//--></script> <body><form method="POST" action="--WEBBOT-SELF--"><!--webbot bot="SaveResults" U-File="C:\Documents and Settings\161470\Desktop\_private\form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><table border="0" width="50%" id="table1" align=center><tr><td>User Name</td><td><input type="text" name="UserName" size="20" value='rachit'></td></tr><tr><td>Password</td><td><input type="text" name="Password" size="20" value='password1'></td></tr></table><p align="center"><input type="button" value="Submit" name="B1" onclick="ValidateAuthentication()"><input type="reset" value="Reset" name="B2"></p></form><table border="0" width="50%" id="table2" align=center><tr><td>Another input with same name</td><td><input type="text" name="UserName" size="20"></td></tr></table></body></html>
  12. Use <div id=myId> inside the cell.Now get div element in javascript using getElementById("myId").use .innerHTML = "<input><img >"If this is not a hint to the solution, I think you should be more clear on the problem.
  13. I could not get your point. Why did you put the title as Help
  14. AlleyCat, Error is also an event in itself.In late 90's Microsoft came up with event bubbling and Netscape with event capturing. Those are differnet approaches for handling events. Netscape 4 supported event capturing but its buggy. So netscape changed to event bubbling. Now all the browsers support event bubbling.In the above code the first input has no event function attached; but still the event is passed to Body tag (which is parent class/parent node). This is event bubbling. The event passes to parent class regardless of whether its handled or not handled at the element level.For the second input it has event function which will be executed first. Then the event will propogate to BODY tag. The same event will fire again. It has fired twice. Once at the element level and second time at parent node level. This clarifies event bubbling. The event is fired at element level and again it will fire on parent class/node/tag. If you cancel event bubbling then the same code would not alert for the first element, and it would alert (element level event) only once. You wont get the body tag's event function executed.Check out this pagehttp://www.quirksmode.org/js/events_order.html
  15. Thanx for all that you have discussed here in this thread. It cleared a cruicial understanding of how javascript may parse the script.HTML/Javascript is like my hobby/interest.If I come to know something offbeat (advanced technical details) about javascript/HTML then I think I would accumulate advanced knowledge.I would say I have intermediate level understanding in HTML/Javascript. I want to be advanced in this topic and that was the reason I joined this forum. Dont take literal meaning of "offbeat". I dont mean unusual, I mean advanced or tricky.
×
×
  • Create New...