Jump to content

Rachit Shah

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Rachit Shah

  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.
  16. Chocolate plz check this. I think you need to understand the problem.http://w3schools.invisionzone.com/index.php?showtopic=3328What u have suggested is not related to the understanding of the behaviour of browser.Plz read the question carefully. cuz I may need help from you. Check the link above.
  17. I am talking about html and not xhtml. http://www.w3schools.com/html/html_standardattributes.aspThanx scott for that. I had misunderstanding in this regard.
  18. You might have more than one elements with same name. Then by accessing document.getElementsByName() is actually an array of elements.Item(0) will represent first element with that name.Item(1) will represent second element with the same name.If there is only one element with that (unique) name, then surely you can use document.getElementsByName().value. I agree with scott. I believe using Id is a good practise.If there are more than one elements with same Id then I think SCOTT has to reconsider his statement!!! ( getElementsbyId().value wont work then). This is silly, but it deserves clarification.I have changed the code and put another input with same name ('UserName'). Still the code will work because of .item(0).value !!!<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 - Put the code for redirection here');}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"></td></tr><tr> <td>Password</td> <td><input type="text" name="Password" size="20"></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>
  19. Hi Ryan, I think skemcin is right. But still if you want to use client side javascript, Find the code below. End-user never know such kind of validations, and he wont check source for the script, so this may work when the content of the pages is not sensitive.You can user same code on server side (Using ASP) and the source is secure. In the browser of the user, it wont show the script ( and hardcoded password, username)Use username = rachit and password = password1<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 - Put the code for redirection here'); } 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="fpweb:///_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"></td> </tr> <tr> <td>Password</td> <td><input type="text" name="Password" size="20"></td> </tr></table> <p align="center"><input type="button" value="Submit" name="B1" onclick="ValidateAuthentication()"><input type="reset" value="Reset" name="B2"></p></form></body></html>
  20. Plz first understand my question.. I have put it as new thread. Check it, I may need your help.
  21. I need some insight regarding below code.In the below code...If I change <\/script> to </script> its giving error.If I change <\/head> to </head> its not giving error. Why? Why? Why?Here is the working code. Its working fine. The above scenario is visible here. I have put it in red. Is this thing Browser specific? I mean Implementation specific?
  22. If I change <\/script> to </script> its giving error.If I change <\/head> to </head> its not giving error. Why? Why? Why?Here is the working code. Its working fine. The above scenario is visible here. I have put it in red.
  23. Plz provide exact relationship between the tables.What you have mentioned in subsequent replies does not clarify the tables and relations.Like lot_status_types is not mentioned anywhere except in the code.I suppose U have to use outer join. Plz paste the code as well table description, I may help you.
  24. If you are talking about two databases in the same DMBS environment, then its possible.Like if you have two databases in two different oracle environments, I mean both the database are oracle database; and you want to access the tables of the other database then its possible through dblink. Suppose..Table1 is in database1Table2 is in database2 Log in to database1 and issue queryselect * from table1; //this would work because the table is in same database. Now create dblink (in database1) for database2 as dblink_db2issue query select * from table2@dblink_db2 This would fetch the records from table2 of database2 ( despite the fact that you are logged in database1).
  25. Rachit Shah

    Oracle

    Check the code in the previous post regarding this topic. I have put the solution there.
×
×
  • Create New...